mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-31 04:31:20 -08:00
fix(docs): update language and formatting in documentation; remove danmuku plugin file
This commit is contained in:
1 parent
47085d1275
commit
86bbc95722
13 files changed
+404
-824
No files matched your search
@@ -1,6 +1,6 @@
|
||||
# Instance Properties
|
||||
|
||||
Here, `instance properties` refer to the `top-level properties` mounted on the `instance`, which are commonly used.
|
||||
Here, `Instance Properties` refer to the `first-level properties` mounted on the `instance`, which are commonly used.
|
||||
|
||||
## `play`
|
||||
|
||||
@@ -50,7 +50,7 @@ art.on('ready', () => {
|
||||
|
||||
- Type: `Function`
|
||||
|
||||
Toggle between playing and pausing the video.
|
||||
Toggle video playback and pause.
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
@@ -75,7 +75,7 @@ art.on('ready', () => {
|
||||
- Type: `Function`
|
||||
- Parameter: `Boolean`
|
||||
|
||||
Destroy the player. Accepts a parameter indicating whether to also remove the player's `html` after destruction. Defaults to `true`.
|
||||
Destroy the player. Accepts a parameter indicating whether to remove the player's `html` after destruction. Defaults to `true`.
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
@@ -90,6 +90,28 @@ art.on('ready', () => {
|
||||
});
|
||||
```
|
||||
|
||||
## `reset`
|
||||
|
||||
- Type: `Function`
|
||||
|
||||
Reset the player's video element: removes the current `src` and calls `load()` once. Commonly used to manually release media resources or reinitialize the video tag in single-page applications.
|
||||
|
||||
> Note: The global configuration `Artplayer.REMOVE_SRC_WHEN_DESTROY` will also automatically execute similar logic when `destroy()` is called.
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
```js{9}
|
||||
var art = new Artplayer({
|
||||
container: '.artplayer-app',
|
||||
url: '/assets/sample/video.mp4',
|
||||
});
|
||||
|
||||
art.on('ready', () => {
|
||||
// Only reset the video, do not remove the interface
|
||||
art.reset();
|
||||
});
|
||||
```
|
||||
|
||||
## `seek`
|
||||
|
||||
- Type: `Setter`
|
||||
@@ -115,7 +137,7 @@ art.on('ready', () => {
|
||||
- Type: `Setter`
|
||||
- Parameter: `Number`
|
||||
|
||||
Fast forward the video by a specified number of seconds.
|
||||
Fast forward the video time, in seconds.
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
@@ -135,7 +157,7 @@ art.on('ready', () => {
|
||||
- Type: `Setter`
|
||||
- Parameter: `Number`
|
||||
|
||||
Rewind the video by a specified number of seconds.
|
||||
Rewind the video time, in seconds.
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
@@ -159,7 +181,7 @@ art.on('ready', () => {
|
||||
- Type: `Setter/Getter`
|
||||
- Parameter: `Number`
|
||||
|
||||
Set or get the video volume. Range: `[0, 1]`.
|
||||
Set and get the video volume, range: `[0, 1]`.
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
@@ -181,7 +203,7 @@ art.on('ready', () => {
|
||||
- Type: `Setter/Getter`
|
||||
- Parameter: `String`
|
||||
|
||||
Set or get the video URL.
|
||||
Set and get the video URL.
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
@@ -240,11 +262,10 @@ art.on('ready', () => {
|
||||
art.switchUrl('/assets/sample/video.mp4?t=0');
|
||||
}, 3000);
|
||||
});
|
||||
```
|
||||
|
||||
:::warning Note
|
||||
|
||||
`art.switch` and `art.switchUrl` have the same functionality, but `art.switchUrl` returns a `Promise`. It `resolves` when the new URL is playable and `rejects` when the new URL fails to load.
|
||||
`art.switch` and `art.switchUrl` have the same functionality, but the `art.switchUrl` method returns a `Promise`. It `resolve`s when the new URL is playable and `reject`s when the new URL fails to load.
|
||||
|
||||
:::
|
||||
|
||||
@@ -253,7 +274,7 @@ art.on('ready', () => {
|
||||
- Type: `Function`
|
||||
- Parameter: `String`
|
||||
|
||||
Sets the video quality URL. Similar to `art.switchUrl`, but preserves the previous playback progress.
|
||||
Sets the video quality URL. Similar to `art.switchUrl`, but retains the previous playback progress.
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
@@ -336,7 +357,7 @@ art.on('ready', () => {
|
||||
|
||||
:::warning Note
|
||||
|
||||
Some videos may not have a duration, such as live streams or videos that haven't finished decoding. In these cases, the obtained duration will be `0`.
|
||||
Some videos may not have a duration, such as live streams or videos that have not been fully decoded. In these cases, the obtained duration will be `0`.
|
||||
|
||||
:::
|
||||
|
||||
@@ -363,7 +384,7 @@ art.on('ready', () => {
|
||||
|
||||
- Type: `Function`
|
||||
|
||||
Gets the `base64` URL of the screenshot for the current video frame. Returns a `Promise`.
|
||||
Gets the `base64` URL of a screenshot of the current video frame. Returns a `Promise`.
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
@@ -375,7 +396,7 @@ var art = new Artplayer({
|
||||
|
||||
art.on('ready', async () => {
|
||||
const url = await art.getDataURL();
|
||||
console.info(url)
|
||||
console.info(url)
|
||||
});
|
||||
```
|
||||
|
||||
@@ -383,7 +404,7 @@ art.on('ready', async () => {
|
||||
|
||||
- Type: `Function`
|
||||
|
||||
Gets the `blob` URL of the screenshot for the current video frame. Returns a `Promise`.
|
||||
Gets the `blob` URL of a screenshot of the current video frame. Returns a `Promise`.
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
@@ -404,7 +425,7 @@ art.on('ready', async () => {
|
||||
- Type: `Setter/Getter`
|
||||
- Parameter: `Boolean`
|
||||
|
||||
Sets and gets the fullscreen state of the player window.
|
||||
Sets and gets the player's window fullscreen state.
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
@@ -426,7 +447,7 @@ var art = new Artplayer({
|
||||
|
||||
:::warning Note
|
||||
|
||||
Due to browser security mechanisms, the page must have prior interaction (e.g., the user has clicked on the page) before triggering window fullscreen.
|
||||
Due to browser security mechanisms, the page must have prior user interaction (e.g., the user has clicked on the page) before triggering window fullscreen.
|
||||
|
||||
:::
|
||||
|
||||
@@ -435,7 +456,7 @@ Due to browser security mechanisms, the page must have prior interaction (e.g.,
|
||||
- Type: `Setter/Getter`
|
||||
- Parameter: `Boolean`
|
||||
|
||||
Sets and gets the web fullscreen state of the player.
|
||||
Sets and gets the player's web page fullscreen state.
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
@@ -460,7 +481,7 @@ art.on('ready', () => {
|
||||
- Type: `Setter/Getter`
|
||||
- Parameter: `Boolean`
|
||||
|
||||
Sets and gets the Picture-in-Picture mode of the player.
|
||||
Sets and gets the player's Picture-in-Picture mode.
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
@@ -482,7 +503,7 @@ var art = new Artplayer({
|
||||
|
||||
:::warning Note
|
||||
|
||||
Due to browser security mechanisms, the page must have prior user interaction (e.g., a user click) before Picture-in-Picture can be triggered.
|
||||
Due to browser security mechanisms, the page must have prior user interaction (e.g., the user has clicked on the page) before triggering Picture-in-Picture.
|
||||
|
||||
:::
|
||||
|
||||
@@ -491,7 +512,7 @@ Due to browser security mechanisms, the page must have prior user interaction (e
|
||||
- Type: `Setter/Getter`
|
||||
- Parameter: `String`
|
||||
|
||||
Sets and gets the video poster. The poster is only visible before video playback starts.
|
||||
Sets and gets the video poster. The poster effect is only visible before video playback starts.
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
@@ -550,11 +571,32 @@ art.on('ready', () => {
|
||||
});
|
||||
```
|
||||
|
||||
## `state`
|
||||
|
||||
- Type: `Setter/Getter`
|
||||
- Parameter: `String`
|
||||
|
||||
Gets or sets the player's current state. Supported values: `standard` (normal), `mini` (mini window), `pip` (picture-in-picture), `fullscreen` (fullscreen window), `fullscreenWeb` (webpage fullscreen).
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
```js{8}
|
||||
var art = new Artplayer({
|
||||
container: '.artplayer-app',
|
||||
url: '/assets/sample/video.mp4',
|
||||
});
|
||||
|
||||
art.on('ready', () => {
|
||||
console.info(art.state); // Default: standard
|
||||
art.state = 'mini';
|
||||
});
|
||||
```
|
||||
|
||||
## `autoSize`
|
||||
|
||||
- Type: `Function`
|
||||
|
||||
Sets whether the video should automatically adjust its size.
|
||||
Sets whether the video adapts its size automatically.
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
@@ -594,12 +636,34 @@ The dimension and coordinate information is obtained via `getBoundingClientRect`
|
||||
|
||||
:::
|
||||
|
||||
## `bottom` / `top` / `left` / `right` / `x` / `y` / `width` / `height`
|
||||
|
||||
- Type: `Getter`
|
||||
|
||||
These properties provide shortcut access to `rect`:
|
||||
|
||||
- `bottom`, `top`, `left`, `right`, `x`, `y`: Correspond to the fields of the same name in `DOMRect`
|
||||
- `width`, `height`: The player's current visible width and height
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
```js{7}
|
||||
var art = new Artplayer({
|
||||
container: '.artplayer-app',
|
||||
url: '/assets/sample/video.mp4',
|
||||
});
|
||||
|
||||
art.on('ready', () => {
|
||||
console.info(art.width, art.height, art.left, art.top);
|
||||
});
|
||||
```
|
||||
|
||||
## `flip`
|
||||
|
||||
- Type: `Setter/Getter`
|
||||
- Parameter: `String`
|
||||
|
||||
Sets and gets the player flip mode. Supports `normal`, `horizontal`, `vertical`.
|
||||
Sets and gets the player flip state. Supported values: `normal`, `horizontal`, `vertical`.
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
@@ -621,7 +685,7 @@ art.on('ready', () => {
|
||||
- Type: `Setter/Getter`
|
||||
- Parameter: `Number`
|
||||
|
||||
Sets and gets the player's playback speed.
|
||||
Sets and gets the player's playback rate.
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
@@ -664,7 +728,7 @@ art.on('ready', () => {
|
||||
|
||||
- Type: `Function`
|
||||
|
||||
When the container only has a defined width, this property can automatically calculate and set the video's height.
|
||||
When the container only has a defined width, this property can automatically calculate and set the video height.
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
@@ -685,7 +749,7 @@ art.on('resize', () => {
|
||||
|
||||
:::warning Note
|
||||
|
||||
This property is useful when your container has a defined width but an unknown height, as it automatically calculates the video's height. However, you need to determine the appropriate timing to set this property.
|
||||
This property is useful when your container has only a defined width but an unknown height. It automatically calculates the video height, but you need to determine the appropriate timing to set this property.
|
||||
|
||||
:::
|
||||
|
||||
@@ -731,6 +795,7 @@ art.on('ready', () => {
|
||||
art.type = 'm3u8';
|
||||
console.info(art.type);
|
||||
});
|
||||
```
|
||||
|
||||
## `theme`
|
||||
|
||||
@@ -797,6 +862,25 @@ art.on('video:timeupdate', () => {
|
||||
});
|
||||
```
|
||||
|
||||
## `loadedTime`
|
||||
|
||||
- Type: `Getter`
|
||||
|
||||
The amount of media that has been buffered, in seconds. Typically used alongside `loaded` to display detailed buffering progress.
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
```js{7}
|
||||
var art = new Artplayer({
|
||||
container: '.artplayer-app',
|
||||
url: '/assets/sample/video.mp4',
|
||||
});
|
||||
|
||||
art.on('video:timeupdate', () => {
|
||||
console.info(art.loadedTime);
|
||||
});
|
||||
```
|
||||
|
||||
## `played`
|
||||
|
||||
- Type: `Getter`
|
||||
@@ -820,7 +904,7 @@ art.on('video:timeupdate', () => {
|
||||
|
||||
- Type: `Function`
|
||||
|
||||
A proxy function for DOM events, essentially proxying `addEventListener` and `removeEventListener`. When using `proxy` to handle events, the event will be automatically removed when the player is destroyed.
|
||||
A proxy function for `DOM` events, essentially proxying `addEventListener` and `removeEventListener`. When using `proxy` to handle events, the event is automatically removed when the player is destroyed.
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
@@ -839,7 +923,7 @@ art.proxy(container, 'click', event => {
|
||||
|
||||
:::warning Note
|
||||
|
||||
If you need certain DOM events to exist only for the duration of the player's lifecycle, it is strongly recommended to use this function to avoid memory leaks.
|
||||
If you need `DOM` events to exist only for the duration of the player's lifecycle, it is strongly recommended to use this function to avoid memory leaks.
|
||||
|
||||
:::
|
||||
|
||||
@@ -847,7 +931,7 @@ If you need certain DOM events to exist only for the duration of the player's li
|
||||
|
||||
- Type: `Function`
|
||||
|
||||
A DOM query function, similar to `document.querySelector`, but the search is scoped to within the current player, preventing errors from duplicate class names.
|
||||
A `DOM` query function, similar to `document.querySelector`, but the search is scoped to the current player instance, preventing errors from duplicate class names.
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
@@ -939,14 +1023,13 @@ art.on('ready', () => {
|
||||
];
|
||||
}, 3000);
|
||||
})
|
||||
```
|
||||
|
||||
## `thumbnails`
|
||||
|
||||
- Type: `Setter/Getter`
|
||||
- Parameter: `Object`
|
||||
|
||||
Dynamically sets the thumbnails.
|
||||
Dynamically set thumbnails
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
|
||||
Reference in new issue
Block a user