From 1f53b27d4e761af5f1854aff25888a07d7826b99 Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Tue, 23 Jan 2018 18:00:08 +1100 Subject: Version bump --- src/js/plyr.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/js') diff --git a/src/js/plyr.js b/src/js/plyr.js index 36b74e76..744c4924 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -1,6 +1,6 @@ // ========================================================================== // Plyr -// plyr.js v3.0.0-beta.5 +// plyr.js v3.0.0-beta.6 // https://github.com/sampotts/plyr // License: The MIT License (MIT) // ========================================================================== -- cgit v1.2.3 From b4e22e2e7b6d73bb58778125801618f499c59bcc Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Wed, 24 Jan 2018 09:06:20 +1100 Subject: =?UTF-8?q?Restored=20=E2=80=9CAd=E2=80=9D=20in=20label?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/js/defaults.js | 1 + src/js/plugins/ads.js | 3 ++- src/js/plyr.js | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src/js') diff --git a/src/js/defaults.js b/src/js/defaults.js index dedd4b2b..655e6d95 100644 --- a/src/js/defaults.js +++ b/src/js/defaults.js @@ -179,6 +179,7 @@ const defaults = { reset: 'Reset', none: 'None', disabled: 'Disabled', + advertisment: 'Ad', }, // URLs diff --git a/src/js/plugins/ads.js b/src/js/plugins/ads.js index 5c828141..1028d73e 100644 --- a/src/js/plugins/ads.js +++ b/src/js/plugins/ads.js @@ -155,7 +155,8 @@ class Ads { const update = () => { const time = utils.formatTime(this.manager.getRemainingTime()); - this.elements.container.setAttribute('data-badge-text', time); + const label = `${this.player.config.i18n.advertisment} - ${time}`; + this.elements.container.setAttribute('data-badge-text', label); }; this.countdownTimer = window.setInterval(update, 100); diff --git a/src/js/plyr.js b/src/js/plyr.js index 744c4924..dbc26fff 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -1,6 +1,6 @@ // ========================================================================== // Plyr -// plyr.js v3.0.0-beta.6 +// plyr.js v3.0.0-beta.7 // https://github.com/sampotts/plyr // License: The MIT License (MIT) // ========================================================================== -- cgit v1.2.3 From 5e68f8c8ddd11070a2b2ee11339be8c2c37ed8a5 Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Thu, 25 Jan 2018 22:41:30 +1100 Subject: Attempt to fix YouTube message error, added ads references, changes to bool --- src/js/defaults.js | 5 +++-- src/js/plugins/ads.js | 20 ++++++++++++++++++-- src/js/plugins/youtube.js | 4 ++-- src/js/plyr.js | 5 ++++- 4 files changed, 27 insertions(+), 7 deletions(-) (limited to 'src/js') diff --git a/src/js/defaults.js b/src/js/defaults.js index 655e6d95..b0ccc116 100644 --- a/src/js/defaults.js +++ b/src/js/defaults.js @@ -363,9 +363,10 @@ const defaults = { google: null, }, - // Ads + // Advertisements plugin + // Tag is not required as publisher is determined by vi.ai using the domain ads: { - tag: null, + enabled: false, }, }; diff --git a/src/js/plugins/ads.js b/src/js/plugins/ads.js index 1028d73e..a71336bb 100644 --- a/src/js/plugins/ads.js +++ b/src/js/plugins/ads.js @@ -8,6 +8,22 @@ import utils from '../utils'; +// Build the default tag URL +const getTagUrl = () => { + const params = { + AV_PUBLISHERID: '58c25bb0073ef448b1087ad6', + AV_CHANNELID: '5a0458dc28a06145e4519d21', + AV_URL: '127.0.0.1:3000', + cb: 1, + AV_WIDTH: 640, + AV_HEIGHT: 480, + }; + + const base = 'https://go.aniview.com/api/adserver6/vast/'; + + return `${base}?${utils.buildUrlParams(params)}`; +}; + class Ads { /** * Ads constructor. @@ -16,9 +32,9 @@ class Ads { */ constructor(player) { this.player = player; + this.enabled = player.config.ads.enabled; this.playing = false; this.initialized = false; - this.enabled = utils.is.url(player.config.ads.tag); // Check if a tag URL is provided. if (!this.enabled) { @@ -122,7 +138,7 @@ class Ads { // Request video ads const request = new google.ima.AdsRequest(); - request.adTagUrl = this.player.config.ads.tag; + request.adTagUrl = getTagUrl(); // Specify the linear and nonlinear slot sizes. This helps the SDK // to select the correct creative if multiple are returned diff --git a/src/js/plugins/youtube.js b/src/js/plugins/youtube.js index bec342a7..429e9eb8 100644 --- a/src/js/plugins/youtube.js +++ b/src/js/plugins/youtube.js @@ -108,8 +108,8 @@ const youtube = { playsinline: 1, // Allow iOS inline playback // Tracking for stats - origin: window && window.location.hostname, - widget_referrer: window && window.location.href, + // origin: window ? `${window.location.protocol}//${window.location.host}` : null, + widget_referrer: window ? window.location.href : null, // Captions are flaky on YouTube cc_load_policy: player.captions.active ? 1 : 0, diff --git a/src/js/plyr.js b/src/js/plyr.js index dbc26fff..613cd0d2 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -309,11 +309,14 @@ class Plyr { * Play the media, or play the advertisement */ play() { + // Play the ad if setup + // TODO: Fix the occasional play of the video before the Ad fires? if (this.ads.enabled && !this.ads.initialized) { this.ads.play(); } - this.media.play(); + // Return the promise (for HTML5) + return this.media.play(); } /** -- cgit v1.2.3 From 8f7a8940f36ab85c87a3406a378d383e58ee3d60 Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Thu, 25 Jan 2018 22:42:52 +1100 Subject: Version bump --- src/js/plyr.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/js') diff --git a/src/js/plyr.js b/src/js/plyr.js index 613cd0d2..27019759 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -1,6 +1,6 @@ // ========================================================================== // Plyr -// plyr.js v3.0.0-beta.7 +// plyr.js v3.0.0-beta.8 // https://github.com/sampotts/plyr // License: The MIT License (MIT) // ========================================================================== -- cgit v1.2.3