diff --git a/CHANGELOG_CN.md b/CHANGELOG_CN.md index 93038560b..009c7ba83 100644 --- a/CHANGELOG_CN.md +++ b/CHANGELOG_CN.md @@ -7,10 +7,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Added - url 选项允许传空字符串,可用于异步设置 art.url - -### Added - art.play() 方法统一返回 Promise - play 事件改为异步触发 +- 添加事件列表到 d.ts ## [4.5.2] - 2022-6-22 diff --git a/docs/assets/ts/artplayer.d.ts b/docs/assets/ts/artplayer.d.ts index b956655b6..8dad0c001 100644 --- a/docs/assets/ts/artplayer.d.ts +++ b/docs/assets/ts/artplayer.d.ts @@ -495,6 +495,67 @@ type Option = { type AspectRatio = 'default' | '4:3' | '16:9' | void; type PlaybackRate = 0.5 | 0.75 | 1.0 | 1.25 | 1.5 | 1.75 | 2.0 | void; type Flip = 'normal' | 'horizontal' | 'vertical' | void; +type Events = + | 'video:canplay' + | 'video:canplaythrough' + | 'video:complete' + | 'video:durationchange' + | 'video:emptied' + | 'video:ended' + | 'video:loadeddata' + | 'video:loadeddata' + | 'video:loadedmetadata' + | 'video:pause' + | 'video:play' + | 'video:playing' + | 'video:progress' + | 'video:ratechange' + | 'video:seeked' + | 'video:seeking' + | 'video:stalled' + | 'video:suspend' + | 'video:timeupdate' + | 'video:volumechange' + | 'video:waiting' + | 'hotkey' + | 'destroy' + | 'customType' + | 'url' + | 'subtitleUpdate' + | 'subtitleLoad' + | 'subtitleSwitch' + | 'focus' + | 'blur' + | 'dblclick' + | 'click' + | 'setBar' + | 'hover' + | 'mousemove' + | 'resize' + | 'view' + | 'aspectRatio' + | 'autoHeight' + | 'autoSize' + | 'ready' + | 'error' + | 'flip' + | 'fullscreen' + | 'fullscreenWeb' + | 'loop' + | 'mini' + | 'pause' + | 'pip' + | 'playbackRate' + | 'play' + | 'screenshot' + | 'seek' + | 'subtitleOffset' + | 'switch' + | 'restart' + | 'volume' + | 'lock' + | 'selector' + | string; declare class Player { get aspectRatio(): AspectRatio; @@ -623,10 +684,11 @@ declare class Artplayer extends Player { static FAST_FORWARD_VALUE: number; static FAST_FORWARD_TIME: number; - on(name: string, fn: Function, ctx?: object): void; - once(name: string, fn: Function, ctx?: object): void; - emit(name: string): void; - off(name: string, callback?: Function): void; + on(name: Events, fn: Function, ctx?: object): void; + once(name: Events, fn: Function, ctx?: object): void; + emit(name: Events): void; + off(name: Events, callback?: Function): void; + query(selector: string): HTMLElement; proxy( target: HTMLElement, diff --git a/docs/uncompiled/artplayer/index.js b/docs/uncompiled/artplayer/index.js index 75d2857b4..5cd60935c 100644 --- a/docs/uncompiled/artplayer/index.js +++ b/docs/uncompiled/artplayer/index.js @@ -240,7 +240,7 @@ class Artplayer extends (0, _emitterDefault.default) { return "development"; } static get build() { - return "1656296990952"; + return "1657509322912"; } static get config() { return 0, _configDefault.default; diff --git a/packages/artplayer/types/artplayer.d.ts b/packages/artplayer/types/artplayer.d.ts index b956655b6..8dad0c001 100644 --- a/packages/artplayer/types/artplayer.d.ts +++ b/packages/artplayer/types/artplayer.d.ts @@ -495,6 +495,67 @@ type Option = { type AspectRatio = 'default' | '4:3' | '16:9' | void; type PlaybackRate = 0.5 | 0.75 | 1.0 | 1.25 | 1.5 | 1.75 | 2.0 | void; type Flip = 'normal' | 'horizontal' | 'vertical' | void; +type Events = + | 'video:canplay' + | 'video:canplaythrough' + | 'video:complete' + | 'video:durationchange' + | 'video:emptied' + | 'video:ended' + | 'video:loadeddata' + | 'video:loadeddata' + | 'video:loadedmetadata' + | 'video:pause' + | 'video:play' + | 'video:playing' + | 'video:progress' + | 'video:ratechange' + | 'video:seeked' + | 'video:seeking' + | 'video:stalled' + | 'video:suspend' + | 'video:timeupdate' + | 'video:volumechange' + | 'video:waiting' + | 'hotkey' + | 'destroy' + | 'customType' + | 'url' + | 'subtitleUpdate' + | 'subtitleLoad' + | 'subtitleSwitch' + | 'focus' + | 'blur' + | 'dblclick' + | 'click' + | 'setBar' + | 'hover' + | 'mousemove' + | 'resize' + | 'view' + | 'aspectRatio' + | 'autoHeight' + | 'autoSize' + | 'ready' + | 'error' + | 'flip' + | 'fullscreen' + | 'fullscreenWeb' + | 'loop' + | 'mini' + | 'pause' + | 'pip' + | 'playbackRate' + | 'play' + | 'screenshot' + | 'seek' + | 'subtitleOffset' + | 'switch' + | 'restart' + | 'volume' + | 'lock' + | 'selector' + | string; declare class Player { get aspectRatio(): AspectRatio; @@ -623,10 +684,11 @@ declare class Artplayer extends Player { static FAST_FORWARD_VALUE: number; static FAST_FORWARD_TIME: number; - on(name: string, fn: Function, ctx?: object): void; - once(name: string, fn: Function, ctx?: object): void; - emit(name: string): void; - off(name: string, callback?: Function): void; + on(name: Events, fn: Function, ctx?: object): void; + once(name: Events, fn: Function, ctx?: object): void; + emit(name: Events): void; + off(name: Events, callback?: Function): void; + query(selector: string): HTMLElement; proxy( target: HTMLElement,