Fixed string literal and position issue of the midroll cue inside the time line. Added a check for the progress element existence.

This commit is contained in:
Arthur Hulsman 2018-01-17 15:57:10 +01:00
parent 0cb2f95888
commit 31c8166562

View File

@ -159,12 +159,15 @@ class Ads {
this.adsCuePoints.forEach((cuePoint) => {
if (cuePoint !== 0 && cuePoint !== -1) {
const seekElement = this.player.elements.progress;
if(seekElement) {
const cuePercentage = 100 / this.player.duration * cuePoint;
const cue = utils.createElement('span', {
class: this.player.config.classNames.cues,
});
cue.style.left = cuePoint.toString() + 'px';
cue.style.left = `${cuePercentage.toString()}%`;
seekElement.appendChild(cue);
}
}
});
// Add listeners to the required events.