mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-23 22:01:20 -08:00
添加字幕url的getter和setter
This commit is contained in:
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(() => {
|
||||
|
||||
@@ -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 },
|
||||
|
||||
Reference in new issue
Block a user