diff options
author | Arthur Hulsman <a.hulsman@orangegames.com> | 2018-01-17 15:57:10 +0100 |
---|---|---|
committer | Arthur Hulsman <a.hulsman@orangegames.com> | 2018-01-17 15:57:10 +0100 |
commit | 31c816656267efa495d02e7f3429d35d91f9c648 (patch) | |
tree | fb9a428e6433d5105a9a165b7c0a0d0cce619659 | |
parent | 0cb2f9588845dc7cf93c3bec45968100c2db8166 (diff) | |
download | plyr-31c816656267efa495d02e7f3429d35d91f9c648.tar.lz plyr-31c816656267efa495d02e7f3429d35d91f9c648.tar.xz plyr-31c816656267efa495d02e7f3429d35d91f9c648.zip |
Fixed string literal and position issue of the midroll cue inside the time line. Added a check for the progress element existence.
-rw-r--r-- | src/js/plugins/ads.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/js/plugins/ads.js b/src/js/plugins/ads.js index dcd236a9..0b12a8e7 100644 --- a/src/js/plugins/ads.js +++ b/src/js/plugins/ads.js @@ -159,11 +159,14 @@ class Ads { this.adsCuePoints.forEach((cuePoint) => { 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); + if(seekElement) { + const cuePercentage = 100 / this.player.duration * cuePoint; + const cue = utils.createElement('span', { + class: this.player.config.classNames.cues, + }); + cue.style.left = `${cuePercentage.toString()}%`; + seekElement.appendChild(cue); + } } }); |