添加字幕切换方法

This commit is contained in:
Harvey committed 2019-09-29 17:02:35 +08:00
1 parent 6f84fcc8f2
commit 8d6dcdf6aa
5 files changed
+24 -10

No files matched your search

+4
View File
@@ -7,6 +7,7 @@ export default class Subtitle {
this.state = true;
this.isInit = false;
const { url } = this.art.option.subtitle;
this.switch = this.init.bind(this);
if (url) {
this.init(url);
}
@@ -31,6 +32,9 @@ export default class Subtitle {
this.load(url).then(url => {
$subtitle.innerHTML = '';
const lastUrl = this.art.template.$track.src;
if (lastUrl === url) return;
URL.revokeObjectURL(lastUrl);
this.art.template.$track.src = url;
this.art.emit('subtitle:load', url);