Update ads
This commit is contained in:
parent
9981c349be
commit
1b13ddaa54
@ -53,7 +53,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
},
|
||||
ads: {
|
||||
enabled: true,
|
||||
publisherId: 'plyrio',
|
||||
},
|
||||
});
|
||||
|
||||
|
25
dist/plyr.js
vendored
25
dist/plyr.js
vendored
@ -4662,7 +4662,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) {
|
||||
@ -4672,7 +4673,7 @@ var Ads = function () {
|
||||
this.trigger('loaded');
|
||||
|
||||
// Bubble event
|
||||
dispatchEvent('loaded');
|
||||
dispatchEvent(event.type);
|
||||
|
||||
// Start countdown
|
||||
this.pollCountdown(true);
|
||||
@ -4692,7 +4693,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.
|
||||
@ -4725,7 +4726,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();
|
||||
|
||||
@ -4737,7 +4738,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();
|
||||
|
||||
@ -4746,23 +4747,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:
|
||||
|
2
dist/plyr.js.map
vendored
2
dist/plyr.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/plyr.min.js
vendored
2
dist/plyr.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/plyr.min.js.map
vendored
2
dist/plyr.min.js.map
vendored
File diff suppressed because one or more lines are too long
25
dist/plyr.polyfilled.js
vendored
25
dist/plyr.polyfilled.js
vendored
@ -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:
|
||||
|
2
dist/plyr.polyfilled.js.map
vendored
2
dist/plyr.polyfilled.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/plyr.polyfilled.min.js
vendored
2
dist/plyr.polyfilled.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/plyr.polyfilled.min.js.map
vendored
2
dist/plyr.polyfilled.min.js.map
vendored
File diff suppressed because one or more lines are too long
@ -376,7 +376,7 @@ const defaults = {
|
||||
// Register for an account here: http://vi.ai/publisher-video-monetization/?aid=plyrio
|
||||
ads: {
|
||||
enabled: false,
|
||||
publisherId: null,
|
||||
publisherId: '918848828995742',
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -256,7 +256,8 @@ class Ads {
|
||||
|
||||
// Proxy event
|
||||
const dispatchEvent = type => {
|
||||
utils.dispatchEvent.call(this.player, this.player.media, `ads${type}`);
|
||||
const event = `ads${type.replace(/_/g, '').toLowerCase()}`;
|
||||
utils.dispatchEvent.call(this.player, this.player.media, event);
|
||||
};
|
||||
|
||||
switch (event.type) {
|
||||
@ -266,7 +267,7 @@ class Ads {
|
||||
this.trigger('loaded');
|
||||
|
||||
// Bubble event
|
||||
dispatchEvent('loaded');
|
||||
dispatchEvent(event.type);
|
||||
|
||||
// Start countdown
|
||||
this.pollCountdown(true);
|
||||
@ -286,7 +287,7 @@ class Ads {
|
||||
// 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.
|
||||
@ -319,7 +320,7 @@ class Ads {
|
||||
// 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();
|
||||
|
||||
@ -331,7 +332,7 @@ class Ads {
|
||||
// Fired when content should be resumed. This usually happens when an ad finishes
|
||||
// or collapses
|
||||
|
||||
dispatchEvent('contentresume');
|
||||
dispatchEvent(event.type);
|
||||
|
||||
this.pollCountdown();
|
||||
|
||||
@ -340,23 +341,11 @@ class Ads {
|
||||
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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user