mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-25 08:01:20 -08:00
update
This commit is contained in:
1 parent
0c70663345
commit
640360abd7
4 files changed
+71
-12
No files matched your search
@@ -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%;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user