aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/plyr.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/js/plyr.js')
-rw-r--r--src/js/plyr.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/js/plyr.js b/src/js/plyr.js
index 7f8ad18c..9b73423e 100644
--- a/src/js/plyr.js
+++ b/src/js/plyr.js
@@ -309,14 +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;
+ this.ads.managerPromise.then(() => {
+ this.ads.play();
+ }).catch(() => {
+ this.media.play();
+ });
+ } else {
+ this.media.play();
}
-
- // Return the promise (for HTML5)
- return this.media.play();
}
/**