添加字幕url的getter和setter

This commit is contained in:
zhw2590582 committed 2019-10-01 19:51:10 +08:00
1 parent 8d6dcdf6aa
commit 31d1949da0
5 files changed
+98 -23

No files matched your search

@@ -6,6 +6,15 @@ export default function attachUrlMix(art, player) {
template: { $video },
} = art;
Object.defineProperty(player, 'url', {
get() {
return $video.src;
},
set() {
errorHandle(false, 'You should use this method: art.attachUrl()');
},
});
Object.defineProperty(player, 'attachUrl', {
value: url =>
sleep().then(() => {
+12 -1
View File
@@ -7,12 +7,23 @@ 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);
}
}
get url() {
const { $track } = this.art.template;
if ($track) {
return $track.src;
}
return '';
}
set url(url) {
this.init(url);
}
init(url) {
const {
events: { proxy },