Skip to content

Commit

Permalink
Feat: close subtitle
Browse files Browse the repository at this point in the history
  • Loading branch information
LazyCreeper committed Dec 10, 2023
1 parent 632b5f3 commit 216604f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/plugins/subtitle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ const newSubtitleControl = (
}
>
): ComponentOption => {
subtitles["关闭"] = {
url: "",
type: ""
};
return {
name: "subtitle",
html: newSubtitleHtml("字幕"),
Expand All @@ -31,10 +35,15 @@ const newSubtitleControl = (
url: subtitles[key].url
};
}),
onSelect(this: Artplayer, selector: any, element: HTMLElement, event: Event): void {
onSelect(this: Artplayer, selector: any) {
console.log("切换字幕:", selector.url);
this.subtitle.switch(selector.url);
console.log(element);
if (selector.html === "关闭") {
this.subtitle.show = false;
} else {
this.subtitle.switch(selector.url);
this.subtitle.show = true;
}
return newSubtitleHtml("字幕").outerHTML;
}
};
};
Expand Down

0 comments on commit 216604f

Please sign in to comment.