diff options
author | Arthur Hulsman <a.hulsman@orangegames.com> | 2018-01-18 14:04:47 +0100 |
---|---|---|
committer | Arthur Hulsman <a.hulsman@orangegames.com> | 2018-01-18 14:04:47 +0100 |
commit | ed6048034b86a1de7a705daf28150b79c45def20 (patch) | |
tree | 7b034cebcc026a94eb5805cf31b94e83813ba41b /src/js/plugins/ads.js | |
parent | 8af312fe3cfe55c5003b645f1fcfe23601fc435f (diff) | |
download | plyr-ed6048034b86a1de7a705daf28150b79c45def20.tar.lz plyr-ed6048034b86a1de7a705daf28150b79c45def20.tar.xz plyr-ed6048034b86a1de7a705daf28150b79c45def20.zip |
Noticed that Plyr stopped working when ads are blocked.
Diffstat (limited to 'src/js/plugins/ads.js')
-rw-r--r-- | src/js/plugins/ads.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/js/plugins/ads.js b/src/js/plugins/ads.js index 2e7b1e93..4e405962 100644 --- a/src/js/plugins/ads.js +++ b/src/js/plugins/ads.js @@ -33,7 +33,6 @@ class Ads { * Get the ads instance ready. */ ready() { - this.time = Date.now(); this.adsContainer = null; this.adDisplayContainer = null; this.adsManager = null; @@ -366,11 +365,15 @@ class Ads { play() { const { container } = this.player.elements; - // Initialize the container. Must be done via a user action on mobile devices. - this.adDisplayContainer.initialize(); + if (!this.adsManagerPromise) { + return; + } // Play the requested advertisement whenever the adsManager is ready. this.adsManagerPromise.then(() => { + // Initialize the container. Must be done via a user action on mobile devices. + this.adDisplayContainer.initialize(); + try { if (!this.initialized) { |