remove ads

This commit is contained in:
Harvey committed 2022-06-20 10:09:20 +08:00
1 parent 92f751250e
commit 7bbe1ed0be
16 files changed
+14 -282

No files matched your search

-58
View File
@@ -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');
}
}
-3
View File
@@ -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: [],
+1 -3
View File
@@ -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;
}
-5
View File
@@ -67,11 +67,6 @@ export default {
fastForward: b,
autoPlayback: b,
autoOrientation: b,
ads: [
{
url: s,
},
],
plugins: [f],
whitelist: [`${s}|${f}|${r}`],
layers: [ComponentOption],