Handle race condition for ads lib loading after source change

This commit is contained in:
Sam Potts 2018-08-01 13:56:49 +10:00
parent ba511b51c7
commit 0892d69ba2
5 changed files with 13 additions and 11 deletions

9
dist/plyr.js vendored
View File

@ -6594,6 +6594,11 @@ typeof navigator === "object" && (function (global, factory) {
value: function onAdsManagerLoaded(event) {
var _this6 = this;
// Load could occur after a source change (race condition)
if (!this.enabled) {
return;
}
// Get the ads manager
var settings = new google.ima.AdsRenderingSettings();
@ -6627,10 +6632,6 @@ typeof navigator === "object" && (function (global, factory) {
});
}
// Get skippable state
// TODO: Skip button
// this.player.debug.warn(this.manager.getAdSkippableState());
// Set volume to match player
this.manager.setVolume(this.player.volume);

2
dist/plyr.js.map vendored

File diff suppressed because one or more lines are too long

2
dist/plyr.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -207,6 +207,11 @@ class Ads {
* @param {Event} adsManagerLoadedEvent
*/
onAdsManagerLoaded(event) {
// Load could occur after a source change (race condition)
if (!this.enabled) {
return;
}
// Get the ads manager
const settings = new google.ima.AdsRenderingSettings();
@ -240,10 +245,6 @@ class Ads {
});
}
// Get skippable state
// TODO: Skip button
// this.player.debug.warn(this.manager.getAdSkippableState());
// Set volume to match player
this.manager.setVolume(this.player.volume);