aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/plyr.js
diff options
context:
space:
mode:
authorSam Potts <sam@potts.es>2018-03-10 23:32:55 +1100
committerSam Potts <sam@potts.es>2018-03-10 23:32:55 +1100
commitc734bc4957d217979931388b0946b2f78157402e (patch)
treee88e38b33185bdbe6065675930a54c56e07d9ff3 /src/js/plyr.js
parent572b8a7aca6c4b4fea1a7f7d371915cbe151be3d (diff)
parenteebae4a227f2ac5e60716fe74ab3a934a792c38e (diff)
downloadplyr-c734bc4957d217979931388b0946b2f78157402e.tar.lz
plyr-c734bc4957d217979931388b0946b2f78157402e.tar.xz
plyr-c734bc4957d217979931388b0946b2f78157402e.zip
Merge branch 'beta' of github.com:sampotts/plyr into beta
Diffstat (limited to 'src/js/plyr.js')
-rw-r--r--src/js/plyr.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/js/plyr.js b/src/js/plyr.js
index 7f8ad18c..04913046 100644
--- a/src/js/plyr.js
+++ b/src/js/plyr.js
@@ -309,13 +309,15 @@ class Plyr {
* Play the media, or play the advertisement (if they are not blocked)
*/
play() {
- // 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)
+ if (this.ads.enabled && !this.ads.initialized) {
+ return this.ads.managerPromise.then(() => {
+ this.ads.play();
+ }).catch(() => {
+ this.media.play();
+ });
}
- // Return the promise (for HTML5)
return this.media.play();
}