diff options
Diffstat (limited to 'dist/plyr.polyfilled.js')
-rw-r--r-- | dist/plyr.polyfilled.js | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/dist/plyr.polyfilled.js b/dist/plyr.polyfilled.js index d9c20dd0..d7da45a6 100644 --- a/dist/plyr.polyfilled.js +++ b/dist/plyr.polyfilled.js @@ -10570,7 +10570,8 @@ var Ads = function () { // Proxy event var dispatchEvent = function dispatchEvent(type) { - utils.dispatchEvent.call(_this7.player, _this7.player.media, 'ads' + type); + var event = 'ads' + type.replace(/_/g, ' ').toLowerCase(); + utils.dispatchEvent.call(_this7.player, _this7.player.media, event); }; switch (event.type) { @@ -10580,7 +10581,7 @@ var Ads = function () { this.trigger('loaded'); // Bubble event - dispatchEvent('loaded'); + dispatchEvent(event.type); // Start countdown this.pollCountdown(true); @@ -10600,7 +10601,7 @@ var Ads = function () { // in case the video is re-played // Fire event - dispatchEvent('allcomplete'); + dispatchEvent(event.type); // TODO: Example for what happens when a next video in a playlist would be loaded. // So here we load a new video when all ads are done. @@ -10633,7 +10634,7 @@ var Ads = function () { // for example display a pause button and remaining time. Fired when content should // be paused. This usually happens right before an ad is about to cover the content - dispatchEvent('contentpause'); + dispatchEvent(event.type); this.pauseContent(); @@ -10645,7 +10646,7 @@ var Ads = function () { // Fired when content should be resumed. This usually happens when an ad finishes // or collapses - dispatchEvent('contentresume'); + dispatchEvent(event.type); this.pollCountdown(); @@ -10654,23 +10655,11 @@ var Ads = function () { break; case google.ima.AdEvent.Type.STARTED: - dispatchEvent('started'); - break; - case google.ima.AdEvent.Type.MIDPOINT: - dispatchEvent('midpoint'); - break; - case google.ima.AdEvent.Type.COMPLETE: - dispatchEvent('complete'); - break; - case google.ima.AdEvent.Type.IMPRESSION: - dispatchEvent('impression'); - break; - case google.ima.AdEvent.Type.CLICK: - dispatchEvent('click'); + dispatchEvent(event.type); break; default: |