mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-19 11:21:20 -08:00
remove ads
This commit is contained in:
1 parent
92f751250e
commit
7bbe1ed0be
16 files changed
+14
-282
No files matched your search
@@ -1,58 +0,0 @@
|
||||
export default class Ads {
|
||||
constructor(art) {
|
||||
this.art = art;
|
||||
this.init();
|
||||
}
|
||||
|
||||
get current() {
|
||||
return this.art.option.ads[this.index];
|
||||
}
|
||||
|
||||
get prev() {
|
||||
return this.art.option.ads[this.index - 1];
|
||||
}
|
||||
|
||||
get next() {
|
||||
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.switchUrl(item.url);
|
||||
|
||||
this.art.once('video:timeupdate', () => {
|
||||
this.art.emit('ads:start', item);
|
||||
});
|
||||
|
||||
this.art.once('video:ended', () => {
|
||||
const next = this.next;
|
||||
if (next) {
|
||||
this.index += 1;
|
||||
this.play(next);
|
||||
} else {
|
||||
this.end();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
end() {
|
||||
if (this.isEnd) return;
|
||||
this.isEnd = true;
|
||||
this.playing = false;
|
||||
this.art.option.url = this.urlCache;
|
||||
this.art.switchUrl(this.urlCache);
|
||||
this.art.emit('ads:end');
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,6 @@ import Icons from './icons';
|
||||
import Setting from './setting';
|
||||
import Storage from './storage';
|
||||
import Plugins from './plugins';
|
||||
import Ads from './ads';
|
||||
import Mobile from './mobile';
|
||||
|
||||
let id = 0;
|
||||
@@ -56,7 +55,6 @@ export default class Artplayer extends Emitter {
|
||||
this.controls = new Control(this);
|
||||
this.contextmenu = new Contextmenu(this);
|
||||
this.subtitle = new Subtitle(this);
|
||||
this.ads = new Ads(this);
|
||||
this.info = new Info(this);
|
||||
this.loading = new Loading(this);
|
||||
this.hotkey = new Hotkey(this);
|
||||
@@ -152,7 +150,6 @@ export default class Artplayer extends Emitter {
|
||||
fastForward: false,
|
||||
autoPlayback: false,
|
||||
autoOrientation: false,
|
||||
ads: [],
|
||||
layers: [],
|
||||
contextmenu: [],
|
||||
controls: [],
|
||||
|
||||
@@ -41,7 +41,5 @@ export default function attrInit(art) {
|
||||
art.theme = option.theme;
|
||||
}
|
||||
|
||||
if (option.ads.length === 0) {
|
||||
art.url = option.url;
|
||||
}
|
||||
art.url = option.url;
|
||||
}
|
||||
@@ -67,11 +67,6 @@ export default {
|
||||
fastForward: b,
|
||||
autoPlayback: b,
|
||||
autoOrientation: b,
|
||||
ads: [
|
||||
{
|
||||
url: s,
|
||||
},
|
||||
],
|
||||
plugins: [f],
|
||||
whitelist: [`${s}|${f}|${r}`],
|
||||
layers: [ComponentOption],
|
||||
|
||||
Reference in new issue
Block a user