diff options
Diffstat (limited to 'src/js/plyr.js')
-rw-r--r-- | src/js/plyr.js | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/js/plyr.js b/src/js/plyr.js index 2daedeac..08c608c3 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -276,7 +276,9 @@ class Plyr { } // Setup ads if provided - this.ads = new Ads(this); + if (utils.is.url(this.config.ads.tagUrl)) { + this.ads = new Ads(this); + } } // --------------------------------------- @@ -306,16 +308,21 @@ class Plyr { } /** - * Play the media + * Play the media, or play the advertisement */ play() { - if (this.ads) { - this.ads.play(); - } - - if (!this.ads.playing) { - return this.media.play(); + if (utils.is.url(this.config.ads.tagUrl)) { + if (this.ads.playing) { + return; + } + if (!this.ads.initialized) { + this.ads.play(); + } + if (!this.ads.playing) { + this.media.play(); + } } + this.media.play(); } /** |