Fix bug where ad would play on every play action

This commit is contained in:
ferdiemmen
2018-01-22 21:07:08 +01:00
parent ebf53d14b1
commit 3c8acb4e9e
6 changed files with 6 additions and 19 deletions

View File

@ -485,9 +485,6 @@ class Ads {
this.player.debug.log(this.manager);
});
// Make sure we can re-call advertisements
this.initialized = false;
// Now request some new advertisements
this.requestAds();
});

View File

@ -309,18 +309,8 @@ class Plyr {
* Play the media, or play the advertisement
*/
play() {
if (this.ads.enabled) {
if (this.ads.playing) {
return;
}
if (!this.ads.initialized) {
this.ads.play();
}
if (!this.ads.playing) {
this.media.play();
}
if (this.ads.enabled && !this.ads.initialized) {
this.ads.play();
}
this.media.play();