diff options
author | Arthur Hulsman <a.hulsman@orangegames.com> | 2018-01-17 15:38:26 +0100 |
---|---|---|
committer | Arthur Hulsman <a.hulsman@orangegames.com> | 2018-01-17 15:38:26 +0100 |
commit | 896ea7c689f25e5eed5ad6bcac0e9314cff825ed (patch) | |
tree | 9fc27faccb815b6e67b08425824f1a9004cf787a /src/js/plugins/ads.js | |
parent | 1d1eb02bd734461bad8884c827e79c05d8f77dbd (diff) | |
download | plyr-896ea7c689f25e5eed5ad6bcac0e9314cff825ed.tar.lz plyr-896ea7c689f25e5eed5ad6bcac0e9314cff825ed.tar.xz plyr-896ea7c689f25e5eed5ad6bcac0e9314cff825ed.zip |
Added cue markings within the time line for when midrolls will be displayed. Removed unusued callback parameter.
Diffstat (limited to 'src/js/plugins/ads.js')
-rw-r--r-- | src/js/plugins/ads.js | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/js/plugins/ads.js b/src/js/plugins/ads.js index 3738ed81..1df56b7b 100644 --- a/src/js/plugins/ads.js +++ b/src/js/plugins/ads.js @@ -141,6 +141,7 @@ class Ads { * @param {Event} adsManagerLoadedEvent */ onAdsManagerLoaded(adsManagerLoadedEvent) { + const { container } = this.player.elements; // Get the ads manager. const settings = new google.ima.AdsRenderingSettings(); @@ -156,6 +157,18 @@ class Ads { // Get the cue points for any mid-rolls by filtering out the pre- and post-roll. this.adsCuePoints = this.adsManager.getCuePoints(); + // Add advertisement cue's within the time line if available. + this.adsCuePoints.forEach((cuePoint, index) => { + if (cuePoint !== 0 && cuePoint !== -1) { + const seekElement = this.player.elements.progress; + const cue = utils.createElement('span', { + class: this.player.config.classNames.cues, + }); + cue.style.left = cuePoint.toString() + 'px'; + seekElement.appendChild(cue); + } + }); + // Add listeners to the required events. // Advertisement error events. this.adsManager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, error => this.onAdError(error)); @@ -368,12 +381,12 @@ class Ads { this.adsLoader.contentComplete(); }); - this.player.on('seeking', event => { + this.player.on('seeking', () => { time = this.player.currentTime; return time; }); - this.player.on('seeked', event => { + this.player.on('seeked', () => { const seekedTime = this.player.currentTime; this.adsCuePoints.forEach((cuePoint, index) => { |