mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
Fix ads on playlists
This commit is contained in:
parent
8d44f61f97
commit
a99b6c8695
1 changed files with 20 additions and 22 deletions
|
@ -246,32 +246,30 @@ function reloadAds() {
|
|||
}
|
||||
|
||||
function reloadAdsIfIsReady() {
|
||||
console.log('reloadAdsIfIsReady player.readyState() = '+player.readyState());
|
||||
console.log('reloadAdsIfIsReady player.readyState() = ' + player.readyState());
|
||||
clearTimeout(_reloadAdsTimeout);
|
||||
if (player.ima) {
|
||||
if (player.readyState() > 2) {
|
||||
console.log('reloadAdsIfIsReady is ready');
|
||||
try {
|
||||
var adTagUrl;
|
||||
if (_adTagUrl) {
|
||||
console.log('reloadAdsIfIsReady _adTagUrl', _adTagUrl);
|
||||
adTagUrl = _adTagUrl;
|
||||
} else if (player.ima && player.ima.getAdsManager().M) {
|
||||
console.log('reloadAdsIfIsReady player.ima.getAdsManager().M', player.ima.getAdsManager().M);
|
||||
adTagUrl = player.ima.getAdsManager().M;
|
||||
}
|
||||
//player.ima.setContentWithAdTag(null, adTagUrl, true);
|
||||
//player.ima.initializeAdDisplayContainer();
|
||||
player.ima.changeAdTag(adTagUrl);
|
||||
player.ima.requestAds();
|
||||
} catch (e) {
|
||||
console.log('reloadAdsIfIsReady ERROR', e.message);
|
||||
console.log('reloadAdsIfIsReady is ready');
|
||||
try {
|
||||
var adTagUrl;
|
||||
if (_adTagUrl) {
|
||||
console.log('reloadAdsIfIsReady _adTagUrl', _adTagUrl);
|
||||
adTagUrl = _adTagUrl;
|
||||
} else if (player.ima && player.ima.getAdsManager().M) {
|
||||
console.log('reloadAdsIfIsReady player.ima.getAdsManager().M', player.ima.getAdsManager().M);
|
||||
adTagUrl = player.ima.getAdsManager().M;
|
||||
}
|
||||
} else {
|
||||
_reloadAdsTimeout = setTimeout(function () {
|
||||
reloadAdsIfIsReady();
|
||||
}, 100);
|
||||
//player.ima.setContentWithAdTag(null, adTagUrl, true);
|
||||
//player.ima.initializeAdDisplayContainer();
|
||||
player.ima.changeAdTag(adTagUrl);
|
||||
player.ima.requestAds();
|
||||
} catch (e) {
|
||||
console.log('reloadAdsIfIsReady ERROR', e.message);
|
||||
}
|
||||
} else {
|
||||
_reloadAdsTimeout = setTimeout(function () {
|
||||
reloadAdsIfIsReady();
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue