feat: 增加字幕相关属性和事件,优化字幕切换逻辑

This commit is contained in:
Harvey Zack committed 2024-09-14 16:14:59 +08:00
1 parent a0b6af32d0
commit 2b11d897ff
11 files changed
+38 -27

No files matched your search

+3
View File
@@ -152,6 +152,9 @@ declare class Artplayer extends Player {
readonly subtitle: {
get url(): string;
set url(url: string);
get textTrack(): TextTrack;
get activeCue(): VTTCue;
get cues(): TextTrackCueList;
style(name: string | Partial<CSSStyleDeclaration>, value?: string): void;
switch(url: string, option?: Subtitle): Promise<string>;
} & Component;
+3 -1
View File
@@ -36,9 +36,11 @@ export type Events = {
setting: [state: boolean];
hotkey: [event: Event];
destroy: [];
subtitleUpdate: [text: string];
subtitleBeforeUpdate: [cue: VTTCue];
subtitleAfterUpdate: [cue: VTTCue];
subtitleLoad: [url: string];
subtitleSwitch: [url: string];
subtitleTrackLoad: [track: HTMLTrackElement, event: Event];
focus: [event: Event];
blur: [event: Event];
dblclick: [event: Event];