diff options
Diffstat (limited to 'src/js/plugins/ads.js')
-rw-r--r-- | src/js/plugins/ads.js | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/js/plugins/ads.js b/src/js/plugins/ads.js index a71336bb..72fd49d8 100644 --- a/src/js/plugins/ads.js +++ b/src/js/plugins/ads.js @@ -35,17 +35,27 @@ class Ads { this.enabled = player.config.ads.enabled; this.playing = false; this.initialized = false; + this.blocked = false; + this.enabled = utils.is.url(player.config.ads.tag); // Check if a tag URL is provided. if (!this.enabled) { return; } - // Check if the Google IMA3 SDK is loaded + // Check if the Google IMA3 SDK is loaded or load it ourselves if (!utils.is.object(window.google)) { - utils.loadScript(player.config.urls.googleIMA.api, () => { - this.ready(); - }); + utils.loadScript( + player.config.urls.googleIMA.api, + () => { + this.ready(); + }, + () => { + // Script failed to load or is blocked + this.blocked = true; + this.player.debug.log('Ads error: Google IMA SDK failed to load'); + }, + ); } else { this.ready(); } |