Fix for null manager race condition
This commit is contained in:
parent
b3365a7373
commit
9981c349be
14
dist/plyr.js
vendored
14
dist/plyr.js
vendored
@ -4432,7 +4432,7 @@ var Ads = function () {
|
|||||||
|
|
||||||
if (this.enabled) {
|
if (this.enabled) {
|
||||||
// Check if the Google IMA3 SDK is loaded or load it ourselves
|
// Check if the Google IMA3 SDK is loaded or load it ourselves
|
||||||
if (!utils.is.object(window.google)) {
|
if (!utils.is.object(window.google) || !utils.is.object(window.google.ima)) {
|
||||||
utils.loadScript(this.player.config.urls.googleIMA.api).then(function () {
|
utils.loadScript(this.player.config.urls.googleIMA.api).then(function () {
|
||||||
_this2.ready();
|
_this2.ready();
|
||||||
}).catch(function () {
|
}).catch(function () {
|
||||||
@ -4544,8 +4544,6 @@ var Ads = function () {
|
|||||||
request.forceNonLinearFullSlot = false;
|
request.forceNonLinearFullSlot = false;
|
||||||
|
|
||||||
this.loader.requestAds(request);
|
this.loader.requestAds(request);
|
||||||
|
|
||||||
this.trigger('loaded');
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.onAdError(e);
|
this.onAdError(e);
|
||||||
}
|
}
|
||||||
@ -4585,7 +4583,7 @@ var Ads = function () {
|
|||||||
|
|
||||||
}, {
|
}, {
|
||||||
key: 'onAdsManagerLoaded',
|
key: 'onAdsManagerLoaded',
|
||||||
value: function onAdsManagerLoaded(adsManagerLoadedEvent) {
|
value: function onAdsManagerLoaded(event) {
|
||||||
var _this6 = this;
|
var _this6 = this;
|
||||||
|
|
||||||
// Get the ads manager
|
// Get the ads manager
|
||||||
@ -4597,7 +4595,7 @@ var Ads = function () {
|
|||||||
|
|
||||||
// The SDK is polling currentTime on the contentPlayback. And needs a duration
|
// The SDK is polling currentTime on the contentPlayback. And needs a duration
|
||||||
// so it can determine when to start the mid- and post-roll
|
// so it can determine when to start the mid- and post-roll
|
||||||
this.manager = adsManagerLoadedEvent.getAdsManager(this.player, settings);
|
this.manager = event.getAdsManager(this.player, settings);
|
||||||
|
|
||||||
// Get the cue points for any mid-rolls by filtering out the pre- and post-roll
|
// Get the cue points for any mid-rolls by filtering out the pre- and post-roll
|
||||||
this.cuePoints = this.manager.getCuePoints();
|
this.cuePoints = this.manager.getCuePoints();
|
||||||
@ -4840,7 +4838,7 @@ var Ads = function () {
|
|||||||
|
|
||||||
|
|
||||||
if (!this.managerPromise) {
|
if (!this.managerPromise) {
|
||||||
return;
|
this.resumeContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Play the requested advertisement whenever the adsManager is ready
|
// Play the requested advertisement whenever the adsManager is ready
|
||||||
@ -4864,7 +4862,7 @@ var Ads = function () {
|
|||||||
// VAST response
|
// VAST response
|
||||||
_this9.onAdError(adError);
|
_this9.onAdError(adError);
|
||||||
}
|
}
|
||||||
});
|
}).catch(function () {});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -4949,7 +4947,7 @@ var Ads = function () {
|
|||||||
|
|
||||||
// Now request some new advertisements
|
// Now request some new advertisements
|
||||||
_this10.requestAds();
|
_this10.requestAds();
|
||||||
});
|
}).catch(function () {});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
2
dist/plyr.js.map
vendored
2
dist/plyr.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/plyr.min.js
vendored
2
dist/plyr.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/plyr.min.js.map
vendored
2
dist/plyr.min.js.map
vendored
File diff suppressed because one or more lines are too long
14
dist/plyr.polyfilled.js
vendored
14
dist/plyr.polyfilled.js
vendored
@ -10340,7 +10340,7 @@ var Ads = function () {
|
|||||||
|
|
||||||
if (this.enabled) {
|
if (this.enabled) {
|
||||||
// Check if the Google IMA3 SDK is loaded or load it ourselves
|
// Check if the Google IMA3 SDK is loaded or load it ourselves
|
||||||
if (!utils.is.object(window.google)) {
|
if (!utils.is.object(window.google) || !utils.is.object(window.google.ima)) {
|
||||||
utils.loadScript(this.player.config.urls.googleIMA.api).then(function () {
|
utils.loadScript(this.player.config.urls.googleIMA.api).then(function () {
|
||||||
_this2.ready();
|
_this2.ready();
|
||||||
}).catch(function () {
|
}).catch(function () {
|
||||||
@ -10452,8 +10452,6 @@ var Ads = function () {
|
|||||||
request.forceNonLinearFullSlot = false;
|
request.forceNonLinearFullSlot = false;
|
||||||
|
|
||||||
this.loader.requestAds(request);
|
this.loader.requestAds(request);
|
||||||
|
|
||||||
this.trigger('loaded');
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.onAdError(e);
|
this.onAdError(e);
|
||||||
}
|
}
|
||||||
@ -10493,7 +10491,7 @@ var Ads = function () {
|
|||||||
|
|
||||||
}, {
|
}, {
|
||||||
key: 'onAdsManagerLoaded',
|
key: 'onAdsManagerLoaded',
|
||||||
value: function onAdsManagerLoaded(adsManagerLoadedEvent) {
|
value: function onAdsManagerLoaded(event) {
|
||||||
var _this6 = this;
|
var _this6 = this;
|
||||||
|
|
||||||
// Get the ads manager
|
// Get the ads manager
|
||||||
@ -10505,7 +10503,7 @@ var Ads = function () {
|
|||||||
|
|
||||||
// The SDK is polling currentTime on the contentPlayback. And needs a duration
|
// The SDK is polling currentTime on the contentPlayback. And needs a duration
|
||||||
// so it can determine when to start the mid- and post-roll
|
// so it can determine when to start the mid- and post-roll
|
||||||
this.manager = adsManagerLoadedEvent.getAdsManager(this.player, settings);
|
this.manager = event.getAdsManager(this.player, settings);
|
||||||
|
|
||||||
// Get the cue points for any mid-rolls by filtering out the pre- and post-roll
|
// Get the cue points for any mid-rolls by filtering out the pre- and post-roll
|
||||||
this.cuePoints = this.manager.getCuePoints();
|
this.cuePoints = this.manager.getCuePoints();
|
||||||
@ -10748,7 +10746,7 @@ var Ads = function () {
|
|||||||
|
|
||||||
|
|
||||||
if (!this.managerPromise) {
|
if (!this.managerPromise) {
|
||||||
return;
|
this.resumeContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Play the requested advertisement whenever the adsManager is ready
|
// Play the requested advertisement whenever the adsManager is ready
|
||||||
@ -10772,7 +10770,7 @@ var Ads = function () {
|
|||||||
// VAST response
|
// VAST response
|
||||||
_this9.onAdError(adError);
|
_this9.onAdError(adError);
|
||||||
}
|
}
|
||||||
});
|
}).catch(function () {});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -10857,7 +10855,7 @@ var Ads = function () {
|
|||||||
|
|
||||||
// Now request some new advertisements
|
// Now request some new advertisements
|
||||||
_this10.requestAds();
|
_this10.requestAds();
|
||||||
});
|
}).catch(function () {});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
2
dist/plyr.polyfilled.js.map
vendored
2
dist/plyr.polyfilled.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/plyr.polyfilled.min.js
vendored
2
dist/plyr.polyfilled.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/plyr.polyfilled.min.js.map
vendored
2
dist/plyr.polyfilled.min.js.map
vendored
File diff suppressed because one or more lines are too long
@ -49,7 +49,7 @@ class Ads {
|
|||||||
load() {
|
load() {
|
||||||
if (this.enabled) {
|
if (this.enabled) {
|
||||||
// Check if the Google IMA3 SDK is loaded or load it ourselves
|
// Check if the Google IMA3 SDK is loaded or load it ourselves
|
||||||
if (!utils.is.object(window.google)) {
|
if (!utils.is.object(window.google) || !utils.is.object(window.google.ima)) {
|
||||||
utils
|
utils
|
||||||
.loadScript(this.player.config.urls.googleIMA.api)
|
.loadScript(this.player.config.urls.googleIMA.api)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@ -160,8 +160,6 @@ class Ads {
|
|||||||
request.forceNonLinearFullSlot = false;
|
request.forceNonLinearFullSlot = false;
|
||||||
|
|
||||||
this.loader.requestAds(request);
|
this.loader.requestAds(request);
|
||||||
|
|
||||||
this.trigger('loaded');
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.onAdError(e);
|
this.onAdError(e);
|
||||||
}
|
}
|
||||||
@ -191,7 +189,7 @@ class Ads {
|
|||||||
* This method is called whenever the ads are ready inside the AdDisplayContainer
|
* This method is called whenever the ads are ready inside the AdDisplayContainer
|
||||||
* @param {Event} adsManagerLoadedEvent
|
* @param {Event} adsManagerLoadedEvent
|
||||||
*/
|
*/
|
||||||
onAdsManagerLoaded(adsManagerLoadedEvent) {
|
onAdsManagerLoaded(event) {
|
||||||
// Get the ads manager
|
// Get the ads manager
|
||||||
const settings = new google.ima.AdsRenderingSettings();
|
const settings = new google.ima.AdsRenderingSettings();
|
||||||
|
|
||||||
@ -201,7 +199,7 @@ class Ads {
|
|||||||
|
|
||||||
// The SDK is polling currentTime on the contentPlayback. And needs a duration
|
// The SDK is polling currentTime on the contentPlayback. And needs a duration
|
||||||
// so it can determine when to start the mid- and post-roll
|
// so it can determine when to start the mid- and post-roll
|
||||||
this.manager = adsManagerLoadedEvent.getAdsManager(this.player, settings);
|
this.manager = event.getAdsManager(this.player, settings);
|
||||||
|
|
||||||
// Get the cue points for any mid-rolls by filtering out the pre- and post-roll
|
// Get the cue points for any mid-rolls by filtering out the pre- and post-roll
|
||||||
this.cuePoints = this.manager.getCuePoints();
|
this.cuePoints = this.manager.getCuePoints();
|
||||||
@ -419,11 +417,12 @@ class Ads {
|
|||||||
const { container } = this.player.elements;
|
const { container } = this.player.elements;
|
||||||
|
|
||||||
if (!this.managerPromise) {
|
if (!this.managerPromise) {
|
||||||
return;
|
this.resumeContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Play the requested advertisement whenever the adsManager is ready
|
// Play the requested advertisement whenever the adsManager is ready
|
||||||
this.managerPromise.then(() => {
|
this.managerPromise
|
||||||
|
.then(() => {
|
||||||
// Initialize the container. Must be done via a user action on mobile devices
|
// Initialize the container. Must be done via a user action on mobile devices
|
||||||
this.elements.displayContainer.initialize();
|
this.elements.displayContainer.initialize();
|
||||||
|
|
||||||
@ -443,7 +442,8 @@ class Ads {
|
|||||||
// VAST response
|
// VAST response
|
||||||
this.onAdError(adError);
|
this.onAdError(adError);
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
.catch(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -500,7 +500,8 @@ class Ads {
|
|||||||
*/
|
*/
|
||||||
loadAds() {
|
loadAds() {
|
||||||
// Tell our adsManager to go bye bye
|
// Tell our adsManager to go bye bye
|
||||||
this.managerPromise.then(() => {
|
this.managerPromise
|
||||||
|
.then(() => {
|
||||||
// Destroy our adsManager
|
// Destroy our adsManager
|
||||||
if (this.manager) {
|
if (this.manager) {
|
||||||
this.manager.destroy();
|
this.manager.destroy();
|
||||||
@ -514,7 +515,8 @@ class Ads {
|
|||||||
|
|
||||||
// Now request some new advertisements
|
// Now request some new advertisements
|
||||||
this.requestAds();
|
this.requestAds();
|
||||||
});
|
})
|
||||||
|
.catch(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user