diff options
author | Sam Potts <sam@selz.com> | 2018-01-30 09:22:54 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-30 09:22:54 +1100 |
commit | bb51647fe2f6e8e0eabb3099b58cc334e23936f0 (patch) | |
tree | f0ed45d84bc0304a543bafa08216355e63e55ac8 /src/js/plyr.js | |
parent | 8f7a8940f36ab85c87a3406a378d383e58ee3d60 (diff) | |
parent | 71efbe7a927a9638204129ca7a2d52c498fa7e6e (diff) | |
download | plyr-bb51647fe2f6e8e0eabb3099b58cc334e23936f0.tar.lz plyr-bb51647fe2f6e8e0eabb3099b58cc334e23936f0.tar.xz plyr-bb51647fe2f6e8e0eabb3099b58cc334e23936f0.zip |
Merge pull request #772 from sampotts/fix/ads-blocked
Fix: ads blocked and media playing before ad plays
Diffstat (limited to 'src/js/plyr.js')
-rw-r--r-- | src/js/plyr.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/js/plyr.js b/src/js/plyr.js index 27019759..52fe378e 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -306,13 +306,13 @@ class Plyr { } /** - * Play the media, or play the advertisement + * Play the media, or play the advertisement (if they are not blocked) */ play() { - // Play the ad if setup - // TODO: Fix the occasional play of the video before the Ad fires? - if (this.ads.enabled && !this.ads.initialized) { + // TODO: Always return a promise? + if (this.ads.enabled && !this.ads.initialized && !this.ads.blocked) { this.ads.play(); + return null; } // Return the promise (for HTML5) |