mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-26 00:31:20 -08:00
add ads.init()
This commit is contained in:
1 parent
558e439261
commit
9f7abe181c
3 files changed
+28
-22
No files matched your search
@@ -1,17 +1,7 @@
|
||||
export default class Ads {
|
||||
constructor(art) {
|
||||
this.art = art;
|
||||
const { option } = art;
|
||||
|
||||
this.index = 0;
|
||||
this.isEnd = false;
|
||||
this.playing = false;
|
||||
this.urlCache = option.url;
|
||||
|
||||
if (this.current) {
|
||||
this.playing = true;
|
||||
this.play(this.current);
|
||||
}
|
||||
this.init();
|
||||
}
|
||||
|
||||
get current() {
|
||||
@@ -26,6 +16,18 @@ export default class Ads {
|
||||
return this.art.option.ads[this.index + 1];
|
||||
}
|
||||
|
||||
init() {
|
||||
this.index = 0;
|
||||
this.isEnd = false;
|
||||
this.playing = false;
|
||||
this.urlCache = this.art.option.url;
|
||||
|
||||
if (this.current) {
|
||||
this.playing = true;
|
||||
this.play(this.current);
|
||||
}
|
||||
}
|
||||
|
||||
play(item = {}) {
|
||||
if (this.isEnd) return;
|
||||
this.art.player.switchUrl(item.url);
|
||||
|
||||
Reference in new issue
Block a user