简化事件

This commit is contained in:
Harvey committed 2020-05-22 13:23:28 +08:00
1 parent 938b90f3a7
commit 4718cd186b
36 files changed
+223 -250

No files matched your search

+46 -56
View File
@@ -4,7 +4,7 @@ You can use all the native events of video directly: [MDN web docs - Media event
But be careful to add the `video` prefix in front of the event:
[Run Code](/Events.canplay)
[Run Code](/Events.video)
```js
var art = new Artplayer({
@@ -15,11 +15,15 @@ var art = new Artplayer({
art.on('video:canplay', function (event) {
console.info(event);
});
art.on('video:volumechange', function (event) {
console.info(event);
});
```
## Player custom event
[Run Code](/Events.example)
[Run Code](/Events.custom)
```js
var art = new Artplayer({
@@ -32,57 +36,43 @@ art.on('ready', function (args) {
});
```
| Event | Description | Parameter |
| --------------------- | --------------------------------------- | ------------------------- |
| `ready` | When the video can be played | `undefined` |
| `play` | When the video play | `undefined` |
| `pause` | When the video pause | `undefined` |
| `seek` | When the video seek | Video current time |
| `volume` | When the video volume change | Video volume value |
| `destroy` | When the instance is destroyed | `undefined` |
| `focus` | When the player gets focus | `undefined` |
| `blur` | When the player loses focus | `undefined` |
| `hoverenter` | When the mouse is moved into the player | `undefined` |
| `hoverleave` | When the mouse is moved out the player | `undefined` |
| `resize` | When the player resize | Player size |
| `mousemove` | When the mouse moves over the player | `undefined` |
| `aspectRatioChange` | When aspect ratio change | Aspect ratio |
| `aspectRatioRemove` | When aspect ratio remove | `undefined` |
| `aspectRatioReset` | When aspect ratio reset | `undefined` |
| `customType` | After triggering CustomType | Type name |
| `urlChange` | After the video url change | Video url |
| `autoSizeChange` | When the player auto size change | Player size |
| `autoSizeRemove` | When the player auto size remove | `undefined` |
| `flipChange` | When the player flip change | Flip name |
| `flipRemove` | When the player flip remove | `undefined` |
| `fullscreenChange` | When the full screen status change | Whether full screen |
| `fullscreenWebChange` | When entering web full screen | Whether web full screen |
| `pipChange` | When entering picture in picture | Whether in pip |
| `minChange` | When entering min player | Whether in min player |
| `playbackRateChange` | When playback rate change | Playback rate |
| `playbackRateRemove` | When playback rate remove | `undefined` |
| `playbackRateReset` | When playback rate reset | `undefined` |
| `screenshot` | When a screenshot occurs | Image data uri |
| `switch` | When switching video url | Video url |
| `loopAdd` | When an interval loop is added | Interval arrary |
| `loopRemove` | When the interval loop is deleted | `undefined` |
| `loopStart` | When entering the interval cycle | Interval arrary |
| `subtitleUpdate` | When the subtitles change | Current subtitle text |
| `subtitleSwitch` | When switching subtitles | Current subtitle url |
| `subtitleLoad` | When the subtitles loaded | Current subtitle url |
| `subtitleErr` | When the subtitles load error | Error object |
| `subtitleToggle` | When displaying subtitles | Whether to show |
| `noticeToggle` | When displaying notice | Whether to show |
| `maskToggle` | When displaying mask | Whether to show |
| `loadingToggle` | When displaying loading | Whether to show |
| `layerAdd` | When adding a new layer | Layer configuration |
| `layerToggle` | When displaying layer | Whether to show |
| `infoToggle` | When displaying info | Whether to show |
| `hotkey` | When the hotkey is triggered | Hotkey event object |
| `settingAdd` | When adding a new setting | Setting configuration |
| `settingToggle` | When displaying setting | Whether to show |
| `contextmenuAdd` | When adding a new contextmenu | Contextmenu configuration |
| `contextmenuToggle` | When displaying contextmenu | Whether to show |
| `controlAdd` | When adding a new control | Control configuration |
| `controlToggle` | When displaying control | Whether to show |
| `pluginAdd` | When adding a new plugin | Plugin configuration |
| Event | Description | Parameter |
| ------------------ | ------------------------------------ | -------------------------- |
| `ready` | When the video can be played | `undefined` |
| `play` | When the video play | `undefined` |
| `pause` | When the video pause | `undefined` |
| `seek` | When the video seek | Video current time |
| `volume` | When the video volume change | Video volume value |
| `destroy` | When the player is destroyed | `undefined` |
| `focus` | When the player gets focus | `undefined` |
| `blur` | When the player loses focus | `undefined` |
| `hover` | When the mouse is moved into or out | Whether moved into |
| `resize` | When the player resize | Player size |
| `mousemove` | When the mouse moves over the player | `undefined` |
| `aspectRatio` | When aspect ratio change | Aspect ratio |
| `url` | After the video url change | Video url |
| `autoSize` | When the player auto size change | Player size |
| `flip` | When the player flip change | Flip name |
| `fullscreen` | When the full screen change | Whether full screen |
| `fullscreenWeb` | When the web full screen change | Whether web full screen |
| `fullscreenRotate` | When the rotate full screen change | Whether rotate full screen |
| `pip` | When the picture in picture change | Whether in pip |
| `min` | When the min player change | Whether in min player |
| `playbackRate` | When playback rate change | Playback rate |
| `screenshot` | When a screenshot | Image data uri |
| `switch` | When switching video url | Video url |
| `loop` | When the interval loop change | Interval arrary |
| `subtitleUpdate` | When the subtitles change | Current subtitle text |
| `subtitleSwitch` | When switching subtitles | Current subtitle url |
| `subtitleLoad` | When the subtitles loaded | Current subtitle url |
| `subtitle` | When displaying subtitles | Whether to show |
| `notice` | When displaying notice | Whether to show |
| `mask` | When displaying mask | Whether to show |
| `loading` | When displaying loading | Whether to show |
| `layer` | When displaying layer | Whether to show |
| `info` | When displaying info | Whether to show |
| `setting` | When displaying setting | Whether to show |
| `contextmenu` | When displaying contextmenu | Contextmenu configuration |
| `control` | When displaying control | Control configuration |
| `hotkey` | When the hotkey is triggered | Hotkey event object |
| `plugin` | When adding a new plugin | Plugin configuration |
+1 -1
View File
@@ -21,7 +21,7 @@
repo: 'zhw2590582/ArtPlayer',
maxLevel: 4,
auto2top: true,
subMaxLevel: 2,
subMaxLevel: 3,
loadSidebar: true,
plugins: [function (hook) {
hook.ready(function () {