mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-04 10:19:24 +02:00
Fix ads on playlists
This commit is contained in:
parent
efaf4457e6
commit
72c7c2666c
1 changed files with 33 additions and 6 deletions
|
@ -166,7 +166,9 @@ function setPlayerListners() {
|
|||
clearTimeout(promisePlayTimeout);
|
||||
console.log("setPlayerListners: play");
|
||||
//userIsControling = true;
|
||||
pauseIfIsPlayinAdsInterval = setInterval(function(){pauseIfIsPlayinAds();},500);
|
||||
pauseIfIsPlayinAdsInterval = setInterval(function () {
|
||||
pauseIfIsPlayinAds();
|
||||
}, 500);
|
||||
});
|
||||
|
||||
$("#mainVideo .vjs-mute-control").click(function () {
|
||||
|
@ -233,7 +235,32 @@ function changeVideoSrcLoad() {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
var _reloadAdsTimeout;
|
||||
function reloadAds() {
|
||||
clearTimeout(_reloadAdsTimeout);
|
||||
console.log('reloadAds');
|
||||
if (player) {
|
||||
if (player.isReady_) {
|
||||
console.log('reloadAds is ready');
|
||||
try {
|
||||
if (_adTagUrl) {
|
||||
console.log('player.ima.changeAdTag _adTagUrl', _adTagUrl);
|
||||
player.ima.changeAdTag(_adTagUrl);
|
||||
} else if (player.ima && player.ima.getAdsManager().M) {
|
||||
console.log('player.ima.getAdsManager().M', player.ima.getAdsManager().M);
|
||||
player.ima.changeAdTag(player.ima.getAdsManager().M);
|
||||
}
|
||||
player.ima.requestAds();
|
||||
} catch (e) {
|
||||
console.log('player.ima.requestAds ERROR', e.message);
|
||||
}
|
||||
} else {
|
||||
_reloadAdsTimeout = setTimeout(function () {
|
||||
reloadAds();
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue