aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/plyr.js
diff options
context:
space:
mode:
authorferdiemmen <fjemmen@gmail.com>2018-01-17 08:31:36 +0100
committerferdiemmen <fjemmen@gmail.com>2018-01-17 08:31:36 +0100
commit8348f79742a40ac465affff7527e7c22dc34cb83 (patch)
tree178a33974b7ef1691ff09e50791a3bfedeab1434 /src/js/plyr.js
parentec73d34bd3061c2b512dda97765e4f38db4619c3 (diff)
downloadplyr-8348f79742a40ac465affff7527e7c22dc34cb83.tar.lz
plyr-8348f79742a40ac465affff7527e7c22dc34cb83.tar.xz
plyr-8348f79742a40ac465affff7527e7c22dc34cb83.zip
Fix loading/playing of the ads when there is no valid ads.tagUrl
Diffstat (limited to 'src/js/plyr.js')
-rw-r--r--src/js/plyr.js23
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();
}
/**