This commit is contained in:
Harvey committed 2022-06-20 11:44:00 +08:00
1 parent 0c70663345
commit 640360abd7
4 files changed
+71 -12

No files matched your search

+37 -5
View File
@@ -9,14 +9,46 @@ export default function artplayerPluginAds(option) {
template: { $player },
} = art;
const $ads = append($player, '<div class="artplayer-plugin-ads"></div>');
append($ads, option.video ? `<video src="${option.video}" controls="false"></video>` : option.html);
function skip() {
//
}
function toggleFullscreen() {
//
}
function toggleMuted() {
//
}
function show() {
art.template.$ads = append($player, '<div class="artplayer-plugin-ads"></div>');
const html = option.video
? `<video class="artplayer-plugin-ads-video" src="${option.video}" controls="false"></video>`
: option.html;
const $ads = append(art.template.$ads, html);
art.proxy($ads, 'click', () => {
if (option.url) window.open(option.url);
art.emit('artplayerPluginAds:click', option);
});
return $ads;
}
art.on('ready', () => {
art.once('play', () => {
art.pause();
const $ads = show();
const isVideo = $ads instanceof HTMLVideoElement;
});
});
return {
name: 'artplayerPluginAds',
skip() {
//
},
skip,
};
};
}
@@ -13,4 +13,9 @@
overflow: hidden;
color: #fff;
background-color: #000;
.artplayer-plugin-ads-video {
width: 100%;
height: 100%;
}
}