mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 17:51:20 -08:00
docs update
This commit is contained in:
1 parent
bf2a996769
commit
0c77a594ba
4 files changed
+402
-299
No files matched your search
+398
-297
@@ -77,7 +77,7 @@ You may need to initialize a size for the container element, like:
|
|||||||
- Default: `''`
|
- Default: `''`
|
||||||
- Required: `true`
|
- Required: `true`
|
||||||
|
|
||||||
Video source url, Three video file formats are supported: mp4, ogg, webm
|
Video source url, Three video file formats are supported: `mp4`, `ogg`, `webm`
|
||||||
|
|
||||||
[Run Code](/)
|
[Run Code](/)
|
||||||
|
|
||||||
@@ -157,7 +157,7 @@ var art = new Artplayer({
|
|||||||
- Type: `String`
|
- Type: `String`
|
||||||
- Default: `''`
|
- Default: `''`
|
||||||
|
|
||||||
Video title, will be shown in screenshot file name and pip mode
|
Video title, will be shown in `screenshot` file name and `pip` mode
|
||||||
|
|
||||||
[Run Code](/)
|
[Run Code](/)
|
||||||
|
|
||||||
@@ -304,7 +304,7 @@ var art = new Artplayer({
|
|||||||
- Type: `Boolean`
|
- Type: `Boolean`
|
||||||
- Default: `false`
|
- Default: `false`
|
||||||
|
|
||||||
Whether to show screenshot controller in the bottom
|
Whether to show screenshot controller in the bottom, If the video resource exists cross-domain, the screenshot may fail. Unless serves this url with the correct `Access-Control-Allow-Origin`, and Set the video's `crossOrigin` property to `anonymous`
|
||||||
|
|
||||||
[Run Code](/)
|
[Run Code](/)
|
||||||
|
|
||||||
@@ -314,6 +314,11 @@ var art = new Artplayer({
|
|||||||
container: '.artplayer-app',
|
container: '.artplayer-app',
|
||||||
url: url + '/video/one-more-time-one-more-chance-480p.mp4',
|
url: url + '/video/one-more-time-one-more-chance-480p.mp4',
|
||||||
screenshot: true,
|
screenshot: true,
|
||||||
|
|
||||||
|
// Optional
|
||||||
|
moreVideoAttr: {
|
||||||
|
crossOrigin: 'anonymous',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -479,7 +484,7 @@ var art = new Artplayer({
|
|||||||
- Type: `String`
|
- Type: `String`
|
||||||
- Default: `#f00`
|
- Default: `#f00`
|
||||||
|
|
||||||
Default display language: en, zh-cn, zh-tw
|
Default theme color
|
||||||
|
|
||||||
[Run Code](/)
|
[Run Code](/)
|
||||||
|
|
||||||
@@ -499,19 +504,10 @@ var art = new Artplayer({
|
|||||||
|
|
||||||
Custom subtitle
|
Custom subtitle
|
||||||
|
|
||||||
### url
|
| propertie | type | Description |
|
||||||
|
| --------- | -------- | ---------------------------------------- |
|
||||||
- Type: `String`
|
| `url` | `String` | Subtitle url, support vtt and srt format |
|
||||||
- Default: `''`
|
| `style` | `Object` | Subtitle style |
|
||||||
|
|
||||||
Subtitle url, support vtt and srt format
|
|
||||||
|
|
||||||
### style
|
|
||||||
|
|
||||||
- Type: `Object`
|
|
||||||
- Default: `{}`
|
|
||||||
|
|
||||||
Subtitle style
|
|
||||||
|
|
||||||
[Run Code](/)
|
[Run Code](/)
|
||||||
|
|
||||||
@@ -536,40 +532,13 @@ var art = new Artplayer({
|
|||||||
|
|
||||||
Custom thumbnails in the progress bar with lazy load
|
Custom thumbnails in the progress bar with lazy load
|
||||||
|
|
||||||
### style
|
| propertie | type | Description |
|
||||||
|
| --------- | -------- | -------------------- |
|
||||||
- Type: `String`
|
| `url` | `String` | Thumbnails image url |
|
||||||
- Default: `''`
|
| `number` | `Number` | Thumbnails number |
|
||||||
|
| `width` | `Number` | Thumbnails width |
|
||||||
Thumbnails image url
|
| `height` | `Number` | Thumbnails height |
|
||||||
|
| `column` | `Number` | Thumbnails column |
|
||||||
### number
|
|
||||||
|
|
||||||
- Type: `Number`
|
|
||||||
- Default: `60`
|
|
||||||
|
|
||||||
Thumbnails number
|
|
||||||
|
|
||||||
### width
|
|
||||||
|
|
||||||
- Type: `Number`
|
|
||||||
- Default: `160`
|
|
||||||
|
|
||||||
Thumbnails width
|
|
||||||
|
|
||||||
### height
|
|
||||||
|
|
||||||
- Type: `Number`
|
|
||||||
- Default: `90`
|
|
||||||
|
|
||||||
Thumbnails height
|
|
||||||
|
|
||||||
### column
|
|
||||||
|
|
||||||
- Type: `Number`
|
|
||||||
- Default: `10`
|
|
||||||
|
|
||||||
Thumbnails column
|
|
||||||
|
|
||||||
[Run Code](/)
|
[Run Code](/)
|
||||||
|
|
||||||
@@ -614,26 +583,11 @@ var art = new Artplayer({
|
|||||||
|
|
||||||
Custom quality, The type of quality is an object
|
Custom quality, The type of quality is an object
|
||||||
|
|
||||||
### default
|
| propertie | type | Description |
|
||||||
|
| --------- | --------- | ------------------------------------------------------------------------------ |
|
||||||
- Type: `Boolean`
|
| `default` | `Boolean` | Whether the default quality, if not specified, the first quality will be taken |
|
||||||
- Default: `false`
|
| `name` | `String` | Quality name to show |
|
||||||
|
| `url` | `String` | Video url |
|
||||||
Whether the default quality, if not specified, the first quality will be taken
|
|
||||||
|
|
||||||
### name
|
|
||||||
|
|
||||||
- Type: `String`
|
|
||||||
- Default: `''`
|
|
||||||
|
|
||||||
Quality name
|
|
||||||
|
|
||||||
### url
|
|
||||||
|
|
||||||
- Type: `String`
|
|
||||||
- Default: `''`
|
|
||||||
|
|
||||||
Quality url
|
|
||||||
|
|
||||||
[Run Code](/)
|
[Run Code](/)
|
||||||
|
|
||||||
@@ -663,19 +617,10 @@ var art = new Artplayer({
|
|||||||
|
|
||||||
Custom highlight, The type of highlight is an object
|
Custom highlight, The type of highlight is an object
|
||||||
|
|
||||||
### time
|
| propertie | type | Description |
|
||||||
|
| --------- | -------- | ---------------- |
|
||||||
- Type: `Number`
|
| `time` | `Number` | highlight second |
|
||||||
- Default: `0`
|
| `text` | `String` | highlight text |
|
||||||
|
|
||||||
highlight seconds
|
|
||||||
|
|
||||||
### text
|
|
||||||
|
|
||||||
- Type: `String`
|
|
||||||
- Default: `''`
|
|
||||||
|
|
||||||
highlight text
|
|
||||||
|
|
||||||
[Run Code](/)
|
[Run Code](/)
|
||||||
|
|
||||||
@@ -716,54 +661,15 @@ var art = new Artplayer({
|
|||||||
|
|
||||||
Custom layer, The type of layer is an object or function
|
Custom layer, The type of layer is an object or function
|
||||||
|
|
||||||
### disable
|
| propertie | type | Description |
|
||||||
|
| --------- | ------------------- | --------------------------------------------- |
|
||||||
- Type: `Boolean`
|
| `disable` | `Boolean` | Whether to disable |
|
||||||
- Default: `false`
|
| `name` | `String` | The unique name , used for the class name |
|
||||||
|
| `index` | `Number` | The unique index, used for the priority level |
|
||||||
Whether to disable
|
| `html` | `String`、`Element` | The dom element |
|
||||||
|
| `style` | `Object` | The style object |
|
||||||
### name
|
| `click` | `Function` | Click event |
|
||||||
|
| `mounted` | `Function` | Callback after mounted |
|
||||||
- Type: `String`
|
|
||||||
- Default: `layer${id}`
|
|
||||||
|
|
||||||
The unique name , used for the class name
|
|
||||||
|
|
||||||
### index
|
|
||||||
|
|
||||||
- Type: `Number`
|
|
||||||
- Default: `${id}`
|
|
||||||
|
|
||||||
The unique index, used for the priority level
|
|
||||||
|
|
||||||
### html
|
|
||||||
|
|
||||||
- Type: `String`、`Element`
|
|
||||||
- Default: `''`
|
|
||||||
|
|
||||||
The dom element
|
|
||||||
|
|
||||||
### style
|
|
||||||
|
|
||||||
- Type: `Object`
|
|
||||||
- Default: `{}`
|
|
||||||
|
|
||||||
The style object
|
|
||||||
|
|
||||||
### click
|
|
||||||
|
|
||||||
- Type: `Function`
|
|
||||||
- Default: `undefined`
|
|
||||||
|
|
||||||
Click event
|
|
||||||
|
|
||||||
### mounted
|
|
||||||
|
|
||||||
- Type: `Function`
|
|
||||||
- Default: `undefined`
|
|
||||||
|
|
||||||
Callback after mounted
|
|
||||||
|
|
||||||
[Run Code](/)
|
[Run Code](/)
|
||||||
|
|
||||||
@@ -793,54 +699,15 @@ var art = new Artplayer({
|
|||||||
|
|
||||||
Custom contextmenu, The type of layer is an object or function
|
Custom contextmenu, The type of layer is an object or function
|
||||||
|
|
||||||
### disable
|
| propertie | type | Description |
|
||||||
|
| --------- | ------------------- | --------------------------------------------- |
|
||||||
- Type: `Boolean`
|
| `disable` | `Boolean` | Whether to disable |
|
||||||
- Default: `false`
|
| `name` | `String` | The unique name , used for the class name |
|
||||||
|
| `index` | `Number` | The unique index, used for the priority level |
|
||||||
Whether to disable
|
| `html` | `String`、`Element` | The dom element |
|
||||||
|
| `style` | `Object` | The style object |
|
||||||
### name
|
| `click` | `Function` | Click event |
|
||||||
|
| `mounted` | `Function` | Callback after mounted |
|
||||||
- Type: `String`
|
|
||||||
- Default: `layer${id}`
|
|
||||||
|
|
||||||
The unique name , used for the class name
|
|
||||||
|
|
||||||
### index
|
|
||||||
|
|
||||||
- Type: `Number`
|
|
||||||
- Default: `${id}`
|
|
||||||
|
|
||||||
The unique index, used for the priority level
|
|
||||||
|
|
||||||
### html
|
|
||||||
|
|
||||||
- Type: `String`、`Element`
|
|
||||||
- Default: `''`
|
|
||||||
|
|
||||||
The dom element
|
|
||||||
|
|
||||||
### style
|
|
||||||
|
|
||||||
- Type: `Object`
|
|
||||||
- Default: `{}`
|
|
||||||
|
|
||||||
The style object
|
|
||||||
|
|
||||||
### click
|
|
||||||
|
|
||||||
- Type: `Function`
|
|
||||||
- Default: `undefined`
|
|
||||||
|
|
||||||
Click event
|
|
||||||
|
|
||||||
### mounted
|
|
||||||
|
|
||||||
- Type: `Function`
|
|
||||||
- Default: `undefined`
|
|
||||||
|
|
||||||
Callback after mounted
|
|
||||||
|
|
||||||
[Run Code](/)
|
[Run Code](/)
|
||||||
|
|
||||||
@@ -868,61 +735,16 @@ var art = new Artplayer({
|
|||||||
|
|
||||||
Custom controls, The type of controls is an object or function
|
Custom controls, The type of controls is an object or function
|
||||||
|
|
||||||
### disable
|
| propertie | type | Description |
|
||||||
|
| ---------- | ------------------- | ----------------------------------------------------------------- |
|
||||||
- Type: `Boolean`
|
| `disable` | `Boolean` | Whether to disable |
|
||||||
- Default: `false`
|
| `name` | `String` | The unique name , used for the class name |
|
||||||
|
| `index` | `Number` | The unique index, used for the priority level |
|
||||||
Whether to disable
|
| `html` | `String`、`Element` | The dom element |
|
||||||
|
| `style` | `Object` | The style object |
|
||||||
### name
|
| `click` | `Function` | Click event |
|
||||||
|
| `mounted` | `Function` | Callback after mounted |
|
||||||
- Type: `String`
|
| `position` | `String` | The position where the controller appears: `top`, `left`, `right` |
|
||||||
- Default: `layer${id}`
|
|
||||||
|
|
||||||
The unique name , used for the class name
|
|
||||||
|
|
||||||
### index
|
|
||||||
|
|
||||||
- Type: `Number`
|
|
||||||
- Default: `${id}`
|
|
||||||
|
|
||||||
The unique index, used for the priority level
|
|
||||||
|
|
||||||
### html
|
|
||||||
|
|
||||||
- Type: `String`、`Element`
|
|
||||||
- Default: `''`
|
|
||||||
|
|
||||||
The dom element
|
|
||||||
|
|
||||||
### style
|
|
||||||
|
|
||||||
- Type: `Object`
|
|
||||||
- Default: `{}`
|
|
||||||
|
|
||||||
The style object
|
|
||||||
|
|
||||||
### click
|
|
||||||
|
|
||||||
- Type: `Function`
|
|
||||||
- Default: `undefined`
|
|
||||||
|
|
||||||
Click event
|
|
||||||
|
|
||||||
### mounted
|
|
||||||
|
|
||||||
- Type: `Function`
|
|
||||||
- Default: `undefined`
|
|
||||||
|
|
||||||
Callback after mounted
|
|
||||||
|
|
||||||
### position
|
|
||||||
|
|
||||||
- Type: `String`
|
|
||||||
- Default: `undefined`
|
|
||||||
|
|
||||||
The position where the controller appears: top, left, right
|
|
||||||
|
|
||||||
[Run Code](/)
|
[Run Code](/)
|
||||||
|
|
||||||
@@ -984,137 +806,416 @@ art.plugins.myPlugin.doSomething();
|
|||||||
| propertie | type | Description |
|
| propertie | type | Description |
|
||||||
| ----------- | ---------- | ------------------------------------------------ |
|
| ----------- | ---------- | ------------------------------------------------ |
|
||||||
| `isFocus` | `Boolean` | Return to focus state |
|
| `isFocus` | `Boolean` | Return to focus state |
|
||||||
| `isPlaying` | `Boolean` | Return to play state |
|
| `isPlaying` | `Boolean` | Return to playing state |
|
||||||
| `destroy` | `Function` | Destroy instance, will not remove dom by default |
|
| `destroy` | `Function` | Destroy instance, will not remove dom by default |
|
||||||
|
|
||||||
|
[Run Code](/)
|
||||||
|
|
||||||
|
```js
|
||||||
|
var url = 'https://blog.zhw-island.com/assets-cdn';
|
||||||
|
var art = new Artplayer({
|
||||||
|
container: '.artplayer-app',
|
||||||
|
url: url + '/video/one-more-time-one-more-chance-480p.mp4',
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('isFocus', art.isFocus);
|
||||||
|
console.log('isPlaying', art.isPlaying);
|
||||||
|
|
||||||
|
setTimeout(function() {
|
||||||
|
// keep dom
|
||||||
|
art.destroy();
|
||||||
|
|
||||||
|
// remove dom
|
||||||
|
// art.destroy(true);
|
||||||
|
}, 1000);
|
||||||
|
```
|
||||||
|
|
||||||
## player
|
## player
|
||||||
|
|
||||||
| propertie | type | Description |
|
Player core function
|
||||||
| ---------------------- | ---------- | ------------------------------------------------------------------------------------- |
|
|
||||||
| `aspectRatioState` | `String` | Return the current value of aspect ratio |
|
| propertie | type | Description |
|
||||||
| `aspectRatio` | `Function` | Set aspect ratio, Currently only accepts three values:`default`, `4:3`, `16:9` |
|
| ---------------------- | ---------- | ------------------------------------------------------------------------------------------------- |
|
||||||
| `aspectRatioRemove` | `Function` | Remove aspect ratio |
|
| `aspectRatioState` | `String` | Return the current value of aspect ratio |
|
||||||
| `aspectRatioReset` | `Function` | Recalculate the aspect ratio |
|
| `aspectRatio` | `Function` | Set aspect ratio, Currently only accepts three values:`default`, `4:3`, `16:9` |
|
||||||
| `autoSizeState` | `Boolean` | Return the current state of auto size |
|
| `aspectRatioRemove` | `Function` | Remove aspect ratio |
|
||||||
| `autoSize` | `Function` | Set auto size |
|
| `aspectRatioReset` | `Function` | Recalculate the aspect ratio |
|
||||||
| `autoSizeRemove` | `Function` | Remove the auto size |
|
| `autoSizeState` | `Boolean` | Return the current state of auto size |
|
||||||
| `currentTime` | `Number` | `Geter` and `Setter` of the current time |
|
| `autoSize` | `Function` | Set auto size |
|
||||||
| `duration` | `Number` | `Geter` of the duration |
|
| `autoSizeRemove` | `Function` | Remove the auto size |
|
||||||
| `flipState` | `String` | Return the current state of flip |
|
| `currentTime` | `Number` | `Getter` and `Setter` of the current time |
|
||||||
| `flip` | `Function` | Set flip, Currently only accepts three values:`normal`, `horizontal`, `vertical` |
|
| `duration` | `Number` | `Getter` of the duration |
|
||||||
| `flipRemove` | `Function` | Remove the flip |
|
| `flipState` | `String` | Return the current state of flip |
|
||||||
| `fullscreenState` | `Boolean` | Return the current state of fullscreen |
|
| `flip` | `Function` | Set flip, Currently only accepts three values:`normal`, `horizontal`, `vertical` |
|
||||||
| `fullscreenEnabled` | `Function` | Enable fullscreen |
|
| `flipRemove` | `Function` | Remove the flip |
|
||||||
| `fullscreenExit` | `Function` | Exit fullscreen |
|
| `fullscreenState` | `Boolean` | Return the current state of fullscreen |
|
||||||
| `fullscreenToggle` | `Function` | Toggle fullscreen |
|
| `fullscreenEnabled` | `Function` | Enable fullscreen |
|
||||||
| `fullscreenWebState` | `Boolean` | Return the current state of web fullscreen |
|
| `fullscreenExit` | `Function` | Exit fullscreen |
|
||||||
| `fullscreenWebEnabled` | `Function` | Enable web fullscreen |
|
| `fullscreenToggle` | `Function` | Toggle fullscreen |
|
||||||
| `fullscreenWebExit` | `Function` | Exit web fullscreen |
|
| `fullscreenWebState` | `Boolean` | Return the current state of web fullscreen |
|
||||||
| `fullscreenWebToggle` | `Function` | Toggle web fullscreen |
|
| `fullscreenWebEnabled` | `Function` | Enable web fullscreen |
|
||||||
| `loaded` | `Number` | Return the proportion of the load |
|
| `fullscreenWebExit` | `Function` | Exit web fullscreen |
|
||||||
| `pause` | `Function` | Pause playback |
|
| `fullscreenWebToggle` | `Function` | Toggle web fullscreen |
|
||||||
| `pipState` | `Boolean` | Return the current state of pip |
|
| `loaded` | `Number` | Return the proportion of the load |
|
||||||
| `pipEnabled` | `Function` | Enable pip |
|
| `pause` | `Function` | Pause playback |
|
||||||
| `pipExit` | `Function` | Exit pip |
|
| `pipState` | `Boolean` | Return the current state of pip |
|
||||||
| `pipToggle` | `Function` | Toggle pip |
|
| `pipEnabled` | `Function` | Enable pip |
|
||||||
| `playbackRateState` | `String` | Return the current state of playback rate |
|
| `pipExit` | `Function` | Exit pip |
|
||||||
| `playbackRate` | `Function` | Set playbackRate, Currently only accepts three values:0.5, 0.75, 1.0, 1.25, 1.5, 2.0 |
|
| `pipToggle` | `Function` | Toggle pip |
|
||||||
| `playbackRateRemove` | `Function` | Remove the playback rate |
|
| `playbackRateState` | `String` | Return the current state of playback rate |
|
||||||
| `playbackRateReset` | `Function` | Recalculate the playback rate |
|
| `playbackRate` | `Function` | Set playbackRate, Currently only accepts three values:`0.5`, `0.75`, `1.0`, `1.25`, `1.5`, `2.0` |
|
||||||
| `played` | `Number` | Return the proportion of the load |
|
| `playbackRateRemove` | `Function` | Remove the playback rate |
|
||||||
| `screenshot` | `Function` | Download the screenshot |
|
| `playbackRateReset` | `Function` | Recalculate the playback rate |
|
||||||
| `seek` | `Function` | Set the current time |
|
| `played` | `Number` | Return the proportion of the played |
|
||||||
| `switchQuality` | `Function` | Switch quality, and you can give it a name |
|
| `screenshot` | `Function` | Download a screenshot of current time |
|
||||||
| `toggle` | `Function` | Toggle play and pause |
|
| `seek` | `Function` | Set the current time |
|
||||||
| `volume` | `Number` | Geter and Setter of the current volume |
|
| `switchQuality` | `Function` | Switch quality |
|
||||||
| `muted` | `Boolean` | Geter and Setter of the muted |
|
| `toggle` | `Function` | Toggle play and pause |
|
||||||
|
| `volume` | `Number` | `Getter` and `Setter` of the current volume |
|
||||||
|
| `muted` | `Boolean` | `Getter` and `Setter` of the muted |
|
||||||
|
|
||||||
|
[Run Code](/)
|
||||||
|
|
||||||
|
```js
|
||||||
|
var url = 'https://blog.zhw-island.com/assets-cdn';
|
||||||
|
var art = new Artplayer({
|
||||||
|
container: '.artplayer-app',
|
||||||
|
url: url + '/video/one-more-time-one-more-chance-480p.mp4',
|
||||||
|
});
|
||||||
|
|
||||||
|
this.art.on('firstCanplay', () => {
|
||||||
|
art.player.seek(5);
|
||||||
|
art.player.screenshot();
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
## storage
|
## storage
|
||||||
|
|
||||||
|
The player will automatically add a `localStorage` object named `artplayer_settings`, Now the player will only set and read the `volume` value.
|
||||||
|
|
||||||
| propertie | type | Description |
|
| propertie | type | Description |
|
||||||
| --------- | ---------- | --------------- |
|
| --------- | ---------- | --------------- |
|
||||||
| `get` | `Function` | Get the storage |
|
| `get` | `Function` | Get the storage |
|
||||||
| `set` | `Function` | Set the storage |
|
| `set` | `Function` | Set the storage |
|
||||||
|
|
||||||
|
[Run Code](/)
|
||||||
|
|
||||||
|
```js
|
||||||
|
var url = 'https://blog.zhw-island.com/assets-cdn';
|
||||||
|
var art = new Artplayer({
|
||||||
|
container: '.artplayer-app',
|
||||||
|
url: url + '/video/one-more-time-one-more-chance-480p.mp4',
|
||||||
|
});
|
||||||
|
|
||||||
|
art.storage.set('your-key', 'your-value');
|
||||||
|
console.log(art.storage.get('your-key'));
|
||||||
|
```
|
||||||
|
|
||||||
## i18n
|
## i18n
|
||||||
|
|
||||||
| propertie | type | Description |
|
The current support i18n has: `en`, `zh-cn`, `zh-tw`
|
||||||
| --------- | ---------- | -------------------- |
|
|
||||||
| `get` | `Function` | Get the a i18n value |
|
| propertie | type | Description |
|
||||||
| `update` | `Function` | Update the i18n |
|
| --------- | ---------- | ------------------------------- |
|
||||||
|
| `get` | `Function` | Get the a i18n value |
|
||||||
|
| `update` | `Function` | Pass in a parameter for merging |
|
||||||
|
|
||||||
|
[Run Code](/)
|
||||||
|
|
||||||
|
```js
|
||||||
|
var url = 'https://blog.zhw-island.com/assets-cdn';
|
||||||
|
var art = new Artplayer({
|
||||||
|
container: '.artplayer-app',
|
||||||
|
url: url + '/video/one-more-time-one-more-chance-480p.mp4',
|
||||||
|
lang: 'jp',
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(art.i18n.get('Play'));
|
||||||
|
art.i18n.update({
|
||||||
|
'zh-cn': {
|
||||||
|
Language: '简体',
|
||||||
|
},
|
||||||
|
'zh-tw': {
|
||||||
|
Language: '繁體',
|
||||||
|
},
|
||||||
|
jp: {
|
||||||
|
Language: '日文',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(art.i18n.get('Language'));
|
||||||
|
```
|
||||||
|
|
||||||
## notice
|
## notice
|
||||||
|
|
||||||
- Type: `Object`
|
- Type: `Object`
|
||||||
|
|
||||||
> TODO...
|
| propertie | type | Description |
|
||||||
|
| --------- | ---------- | -------------- |
|
||||||
|
| `show` | `Function` | Show a message |
|
||||||
|
| `hide` | `Function` | Hide message |
|
||||||
|
|
||||||
|
[Run Code](/)
|
||||||
|
|
||||||
|
```js
|
||||||
|
var url = 'https://blog.zhw-island.com/assets-cdn';
|
||||||
|
var art = new Artplayer({
|
||||||
|
container: '.artplayer-app',
|
||||||
|
url: url + '/video/one-more-time-one-more-chance-480p.mp4',
|
||||||
|
});
|
||||||
|
|
||||||
|
// auto hide
|
||||||
|
art.notice.show('some message');
|
||||||
|
|
||||||
|
// not auto hide
|
||||||
|
art.notice.show('some message', false);
|
||||||
|
```
|
||||||
|
|
||||||
## events
|
## events
|
||||||
|
|
||||||
|
Agent for managing native events
|
||||||
|
|
||||||
- Type: `Object`
|
- Type: `Object`
|
||||||
|
|
||||||
> TODO...
|
| propertie | type | Description |
|
||||||
|
| --------- | ---------- | ------------------------------------------------------------------------------------ |
|
||||||
|
| `proxy` | `Function` | A proxy for `addEventListener` and `removeEventListener` to manage event destruction |
|
||||||
|
| `hover` | `Function` | Hover simplified proxy |
|
||||||
|
| `loadImg` | `Function` | Determine whether to finish the picture |
|
||||||
|
| `destroy` | `Function` | Destroy all events |
|
||||||
|
|
||||||
|
[Run Code](/)
|
||||||
|
|
||||||
|
```js
|
||||||
|
var url = 'https://blog.zhw-island.com/assets-cdn';
|
||||||
|
var art = new Artplayer({
|
||||||
|
container: '.artplayer-app',
|
||||||
|
url: url + '/video/one-more-time-one-more-chance-480p.mp4',
|
||||||
|
});
|
||||||
|
|
||||||
|
var target = document.querySelector('body');
|
||||||
|
art.events.proxy(target, 'click', function(e) {
|
||||||
|
console.log('body click');
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
## layers
|
## layers
|
||||||
|
|
||||||
|
Layer manager, and every layer has `show` and `hide` funciton
|
||||||
|
|
||||||
- Type: `Object`
|
- Type: `Object`
|
||||||
|
|
||||||
> TODO...
|
| propertie | type | Description |
|
||||||
|
| --------- | ---------- | ----------------------- |
|
||||||
|
| `add` | `Function` | Dynamically add a layer |
|
||||||
|
| `show` | `Function` | Show all layers |
|
||||||
|
| `hide` | `Function` | Hide all layers |
|
||||||
|
|
||||||
|
[Run Code](/)
|
||||||
|
|
||||||
|
```js
|
||||||
|
var url = 'https://blog.zhw-island.com/assets-cdn';
|
||||||
|
var art = new Artplayer({
|
||||||
|
container: '.artplayer-app',
|
||||||
|
url: url + '/video/one-more-time-one-more-chance-480p.mp4',
|
||||||
|
});
|
||||||
|
|
||||||
|
art.layers.add({
|
||||||
|
html: `<img style="width: 100px" src="${url}/image/your-name.png">`,
|
||||||
|
style: {
|
||||||
|
name: 'yourLayer',
|
||||||
|
position: 'absolute',
|
||||||
|
top: '20px',
|
||||||
|
right: '20px',
|
||||||
|
opacity: '.9',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
art.layers.yourLayer.hide();
|
||||||
|
```
|
||||||
|
|
||||||
## controls
|
## controls
|
||||||
|
|
||||||
|
Controls manager, and every control has `show` and `hide` funciton
|
||||||
|
|
||||||
- Type: `Object`
|
- Type: `Object`
|
||||||
|
|
||||||
> TODO...
|
| propertie | type | Description |
|
||||||
|
| --------- | ---------- | ------------------------- |
|
||||||
|
| `add` | `Function` | Dynamically add a control |
|
||||||
|
| `show` | `Function` | Show all controls |
|
||||||
|
| `hide` | `Function` | Hide all controls |
|
||||||
|
|
||||||
|
[Run Code](/)
|
||||||
|
|
||||||
|
```js
|
||||||
|
var url = 'https://blog.zhw-island.com/assets-cdn';
|
||||||
|
var art = new Artplayer({
|
||||||
|
container: '.artplayer-app',
|
||||||
|
url: url + '/video/one-more-time-one-more-chance-480p.mp4',
|
||||||
|
});
|
||||||
|
|
||||||
|
art.controls.add(function yourController(art) {
|
||||||
|
return {
|
||||||
|
name: 'yourController',
|
||||||
|
position: 'right',
|
||||||
|
index: 10,
|
||||||
|
html: 'yourController',
|
||||||
|
click: function() {
|
||||||
|
console.log('yourController');
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
art.controls.yourController.hide();
|
||||||
|
```
|
||||||
|
|
||||||
## contextmenu
|
## contextmenu
|
||||||
|
|
||||||
|
Contextmenu manager, and every contextmenu has `show` and `hide` funciton
|
||||||
|
|
||||||
- Type: `Object`
|
- Type: `Object`
|
||||||
|
|
||||||
> TODO...
|
| propertie | type | Description |
|
||||||
|
| --------- | ---------- | ----------------------------- |
|
||||||
|
| `add` | `Function` | Dynamically add a contextmenu |
|
||||||
|
| `show` | `Function` | Show all contextmenu |
|
||||||
|
| `hide` | `Function` | Hide all contextmenu |
|
||||||
|
|
||||||
|
[Run Code](/)
|
||||||
|
|
||||||
|
```js
|
||||||
|
var url = 'https://blog.zhw-island.com/assets-cdn';
|
||||||
|
var art = new Artplayer({
|
||||||
|
container: '.artplayer-app',
|
||||||
|
url: url + '/video/one-more-time-one-more-chance-480p.mp4',
|
||||||
|
});
|
||||||
|
|
||||||
|
art.contextmenu.add({
|
||||||
|
html: 'Your Contextmenu',
|
||||||
|
name: 'yourContextmenu',
|
||||||
|
});
|
||||||
|
|
||||||
|
art.contextmenu.yourContextmenu.hide();
|
||||||
|
```
|
||||||
|
|
||||||
## subtitle
|
## subtitle
|
||||||
|
|
||||||
- Type: `Object`
|
- Type: `Object`
|
||||||
|
|
||||||
> TODO...
|
| propertie | type | Description |
|
||||||
|
| --------- | ---------- | --------------- |
|
||||||
|
| `switch` | `Function` | Switch subtitle |
|
||||||
|
| `show` | `Function` | Show subtitle |
|
||||||
|
| `hide` | `Function` | Hide subtitle |
|
||||||
|
|
||||||
|
[Run Code](/)
|
||||||
|
|
||||||
|
```js
|
||||||
|
var url = 'https://blog.zhw-island.com/assets-cdn';
|
||||||
|
var art = new Artplayer({
|
||||||
|
container: '.artplayer-app',
|
||||||
|
url: url + '/video/one-more-time-one-more-chance-480p.mp4',
|
||||||
|
subtitle: {
|
||||||
|
url: url + '/subtitle/one-more-time-one-more-chance.srt',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
this.art.on('firstCanplay', () => {
|
||||||
|
art.subtitle.switch(url + '/subtitle/one-more-time-one-more-chance.vtt');
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
## loading
|
## loading
|
||||||
|
|
||||||
- Type: `Object`
|
- Type: `Object`
|
||||||
|
|
||||||
> TODO...
|
| propertie | type | Description |
|
||||||
|
| --------- | ---------- | ------------ |
|
||||||
|
| `show` | `Function` | Show loading |
|
||||||
|
| `hide` | `Function` | Hide loading |
|
||||||
|
|
||||||
## mask
|
## mask
|
||||||
|
|
||||||
- Type: `Object`
|
- Type: `Object`
|
||||||
|
|
||||||
> TODO...
|
| propertie | type | Description |
|
||||||
|
| --------- | ---------- | ----------- |
|
||||||
|
| `show` | `Function` | Show mask |
|
||||||
|
| `hide` | `Function` | Hide mask |
|
||||||
|
|
||||||
## setting
|
## setting
|
||||||
|
|
||||||
|
Setting manager, and every setting has `show` and `hide` funciton
|
||||||
|
|
||||||
- Type: `Object`
|
- Type: `Object`
|
||||||
|
|
||||||
> TODO...
|
| propertie | type | Description |
|
||||||
|
| --------- | ---------- | ------------------------- |
|
||||||
|
| `add` | `Function` | Dynamically add a setting |
|
||||||
|
| `show` | `Function` | Show setting |
|
||||||
|
| `hide` | `Function` | Hide setting |
|
||||||
|
|
||||||
|
[Run Code](/)
|
||||||
|
|
||||||
|
```js
|
||||||
|
var url = 'https://blog.zhw-island.com/assets-cdn';
|
||||||
|
var art = new Artplayer({
|
||||||
|
container: '.artplayer-app',
|
||||||
|
url: url + '/video/one-more-time-one-more-chance-480p.mp4',
|
||||||
|
});
|
||||||
|
|
||||||
|
art.setting.add({
|
||||||
|
html: 'Your Setting',
|
||||||
|
name: 'yourSetting',
|
||||||
|
});
|
||||||
|
|
||||||
|
art.setting.yourSetting.hide();
|
||||||
|
```
|
||||||
|
|
||||||
## plugins
|
## plugins
|
||||||
|
|
||||||
|
Plugins manager
|
||||||
|
|
||||||
- Type: `Object`
|
- Type: `Object`
|
||||||
|
|
||||||
> TODO...
|
| propertie | type | Description |
|
||||||
|
| --------- | ---------- | ------------------------ |
|
||||||
|
| `add` | `Function` | Dynamically add a plugin |
|
||||||
|
|
||||||
|
[Run Code](/)
|
||||||
|
|
||||||
|
```js
|
||||||
|
var url = 'https://blog.zhw-island.com/assets-cdn';
|
||||||
|
var art = new Artplayer({
|
||||||
|
container: '.artplayer-app',
|
||||||
|
url: url + '/video/one-more-time-one-more-chance-480p.mp4',
|
||||||
|
});
|
||||||
|
|
||||||
|
art.plugins.add(function myPlugin(art) {
|
||||||
|
return {
|
||||||
|
// This exposes plugin properties or methods for others to use. Like:
|
||||||
|
something: 'something',
|
||||||
|
doSomething: function() {
|
||||||
|
console.log('Do something here...');
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
art.plugins.myPlugin.doSomething();
|
||||||
|
```
|
||||||
|
|
||||||
# Class static properties
|
# Class static properties
|
||||||
|
|
||||||
All properties are read only
|
All properties are read only
|
||||||
|
|
||||||
| propertie | Description |
|
| propertie | type | Description |
|
||||||
| --------------------- | ------------------------- |
|
| --------------------- | -------- | ------------------------- |
|
||||||
| `Artplayer.version` | Version Information |
|
| `Artplayer.version` | `String` | Version Information |
|
||||||
| `Artplayer.env` | Environmental variable |
|
| `Artplayer.env` | `String` | Environmental variable |
|
||||||
| `Artplayer.config` | Configuration information |
|
| `Artplayer.config` | `Object` | Configuration information |
|
||||||
| `Artplayer.utils` | Utils function |
|
| `Artplayer.utils` | `Object` | Utils function |
|
||||||
| `Artplayer.DEFAULTS` | Default option |
|
| `Artplayer.DEFAULTS` | `Object` | Default option |
|
||||||
| `Artplayer.instances` | Instance collection |
|
| `Artplayer.instances` | `Array` | Instance collection |
|
||||||
|
|
||||||
# Event
|
# Event
|
||||||
|
|
||||||
|
|||||||
@@ -946,6 +946,7 @@
|
|||||||
var firstCanplay = false;
|
var firstCanplay = false;
|
||||||
var reconnectTime = 0;
|
var reconnectTime = 0;
|
||||||
var maxReconnectTime = 5;
|
var maxReconnectTime = 5;
|
||||||
|
art.loading.show();
|
||||||
proxy($video, 'click', function () {
|
proxy($video, 'click', function () {
|
||||||
player.toggle();
|
player.toggle();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"artplayer.js","sources":["../../../packages/artplayer/node_modules/@babel/runtime/helpers/classCallCheck.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/createClass.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/typeof.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/assertThisInitialized.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/getPrototypeOf.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/setPrototypeOf.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/inherits.js","../../../packages/artplayer/node_modules/tiny-emitter/index.js","../../../packages/artplayer/node_modules/option-validator/dist/option-validator.js","../../../packages/artplayer/node_modules/deepmerge/dist/es.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/isNativeFunction.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/construct.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/wrapNativeSuper.js","../../../packages/artplayer/src/utils/error.js","../../../packages/artplayer/src/utils/dom.js","../../../packages/artplayer/src/utils/subtitle.js","../../../packages/artplayer/src/utils/index.js","../../../packages/artplayer/src/scheme/validElement.js","../../../packages/artplayer/src/scheme/validStringEmpty.js","../../../packages/artplayer/src/scheme/index.js","../../../packages/artplayer/src/config/mimeCodec.js","../../../packages/artplayer/src/config/mse.js","../../../packages/artplayer/src/config/video.js","../../../packages/artplayer/src/config/index.js","../../../packages/artplayer/src/whitelist.js","../../../packages/artplayer/src/template.js","../../../packages/artplayer/src/i18n.js","../../../packages/artplayer/src/player/attachUrlMix.js","../../../packages/artplayer/src/player/attrInit.js","../../../packages/artplayer/src/player/eventInit.js","../../../packages/artplayer/src/player/playMix.js","../../../packages/artplayer/src/player/pauseMin.js","../../../packages/artplayer/src/player/toggleMix.js","../../../packages/artplayer/src/player/seekMix.js","../../../packages/artplayer/src/player/volumeMix.js","../../../packages/artplayer/src/player/currentTimeMix.js","../../../packages/artplayer/src/player/durationMix.js","../../../packages/artplayer/src/player/switchQualityMix.js","../../../packages/artplayer/src/player/playbackRateMix.js","../../../packages/artplayer/src/player/aspectRatioMix.js","../../../packages/artplayer/src/player/screenshotMix.js","../../../packages/artplayer/node_modules/screenfull/dist/screenfull.js","../../../packages/artplayer/src/player/fullscreenMix.js","../../../packages/artplayer/src/player/fullscreenWebMix.js","../../../packages/artplayer/node_modules/get-size/get-size.js","../../../packages/artplayer/node_modules/ev-emitter/ev-emitter.js","../../../packages/artplayer/node_modules/unipointer/unipointer.js","../../../packages/artplayer/node_modules/unidragger/unidragger.js","../../../packages/artplayer/node_modules/draggabilly/draggabilly.js","../../../packages/artplayer/src/player/pipMix.js","../../../packages/artplayer/src/player/loadedMix.js","../../../packages/artplayer/src/player/playedMix.js","../../../packages/artplayer/src/player/autoSizeMix.js","../../../packages/artplayer/src/player/flipMix.js","../../../packages/artplayer/src/player/index.js","../../../packages/artplayer/src/mse.js","../../../packages/artplayer/src/utils/component.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/defineProperty.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/objectSpread.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/arrayWithHoles.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/nonIterableRest.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/slicedToArray.js","../../../packages/artplayer/src/icons/index.js","../../../packages/artplayer/src/controls/fullscreen.js","../../../packages/artplayer/src/controls/fullscreenWeb.js","../../../packages/artplayer/src/controls/pip.js","../../../packages/artplayer/src/controls/playAndPause.js","../../../packages/artplayer/src/controls/progress.js","../../../packages/artplayer/src/controls/subtitle.js","../../../packages/artplayer/src/controls/time.js","../../../packages/artplayer/src/controls/volume.js","../../../packages/artplayer/src/controls/setting.js","../../../packages/artplayer/src/controls/thumbnails.js","../../../packages/artplayer/src/controls/screenshot.js","../../../packages/artplayer/src/controls/quality.js","../../../packages/artplayer/src/controls/index.js","../../../packages/artplayer/src/contextmenu/playbackRate.js","../../../packages/artplayer/src/contextmenu/aspectRatio.jLine truncated
|
{"version":3,"file":"artplayer.js","sources":["../../../packages/artplayer/node_modules/@babel/runtime/helpers/classCallCheck.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/createClass.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/typeof.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/assertThisInitialized.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/getPrototypeOf.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/setPrototypeOf.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/inherits.js","../../../packages/artplayer/node_modules/tiny-emitter/index.js","../../../packages/artplayer/node_modules/option-validator/dist/option-validator.js","../../../packages/artplayer/node_modules/deepmerge/dist/es.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/isNativeFunction.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/construct.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/wrapNativeSuper.js","../../../packages/artplayer/src/utils/error.js","../../../packages/artplayer/src/utils/dom.js","../../../packages/artplayer/src/utils/subtitle.js","../../../packages/artplayer/src/utils/index.js","../../../packages/artplayer/src/scheme/validElement.js","../../../packages/artplayer/src/scheme/validStringEmpty.js","../../../packages/artplayer/src/scheme/index.js","../../../packages/artplayer/src/config/mimeCodec.js","../../../packages/artplayer/src/config/mse.js","../../../packages/artplayer/src/config/video.js","../../../packages/artplayer/src/config/index.js","../../../packages/artplayer/src/whitelist.js","../../../packages/artplayer/src/template.js","../../../packages/artplayer/src/i18n.js","../../../packages/artplayer/src/player/attachUrlMix.js","../../../packages/artplayer/src/player/attrInit.js","../../../packages/artplayer/src/player/eventInit.js","../../../packages/artplayer/src/player/playMix.js","../../../packages/artplayer/src/player/pauseMin.js","../../../packages/artplayer/src/player/toggleMix.js","../../../packages/artplayer/src/player/seekMix.js","../../../packages/artplayer/src/player/volumeMix.js","../../../packages/artplayer/src/player/currentTimeMix.js","../../../packages/artplayer/src/player/durationMix.js","../../../packages/artplayer/src/player/switchQualityMix.js","../../../packages/artplayer/src/player/playbackRateMix.js","../../../packages/artplayer/src/player/aspectRatioMix.js","../../../packages/artplayer/src/player/screenshotMix.js","../../../packages/artplayer/node_modules/screenfull/dist/screenfull.js","../../../packages/artplayer/src/player/fullscreenMix.js","../../../packages/artplayer/src/player/fullscreenWebMix.js","../../../packages/artplayer/node_modules/get-size/get-size.js","../../../packages/artplayer/node_modules/ev-emitter/ev-emitter.js","../../../packages/artplayer/node_modules/unipointer/unipointer.js","../../../packages/artplayer/node_modules/unidragger/unidragger.js","../../../packages/artplayer/node_modules/draggabilly/draggabilly.js","../../../packages/artplayer/src/player/pipMix.js","../../../packages/artplayer/src/player/loadedMix.js","../../../packages/artplayer/src/player/playedMix.js","../../../packages/artplayer/src/player/autoSizeMix.js","../../../packages/artplayer/src/player/flipMix.js","../../../packages/artplayer/src/player/index.js","../../../packages/artplayer/src/mse.js","../../../packages/artplayer/src/utils/component.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/defineProperty.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/objectSpread.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/arrayWithHoles.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/nonIterableRest.js","../../../packages/artplayer/node_modules/@babel/runtime/helpers/slicedToArray.js","../../../packages/artplayer/src/icons/index.js","../../../packages/artplayer/src/controls/fullscreen.js","../../../packages/artplayer/src/controls/fullscreenWeb.js","../../../packages/artplayer/src/controls/pip.js","../../../packages/artplayer/src/controls/playAndPause.js","../../../packages/artplayer/src/controls/progress.js","../../../packages/artplayer/src/controls/subtitle.js","../../../packages/artplayer/src/controls/time.js","../../../packages/artplayer/src/controls/volume.js","../../../packages/artplayer/src/controls/setting.js","../../../packages/artplayer/src/controls/thumbnails.js","../../../packages/artplayer/src/controls/screenshot.js","../../../packages/artplayer/src/controls/quality.js","../../../packages/artplayer/src/controls/index.js","../../../packages/artplayer/src/contextmenu/playbackRate.js","../../../packages/artplayer/src/contextmenu/aspectRatio.jLine truncated
|
||||||
@@ -12,7 +12,8 @@ export default function eventInit(art, player) {
|
|||||||
let firstCanplay = false;
|
let firstCanplay = false;
|
||||||
let reconnectTime = 0;
|
let reconnectTime = 0;
|
||||||
const maxReconnectTime = 5;
|
const maxReconnectTime = 5;
|
||||||
|
art.loading.show();
|
||||||
|
|
||||||
proxy($video, 'click', () => {
|
proxy($video, 'click', () => {
|
||||||
player.toggle();
|
player.toggle();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user