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,11 +159,14 @@ class Ads {
this.adsCuePoints.forEach((cuePoint) => { this.adsCuePoints.forEach((cuePoint) => {
if (cuePoint !== 0 && cuePoint !== -1) { if (cuePoint !== 0 && cuePoint !== -1) {
const seekElement = this.player.elements.progress; const seekElement = this.player.elements.progress;
const cue = utils.createElement('span', { if(seekElement) {
class: this.player.config.classNames.cues, const cuePercentage = 100 / this.player.duration * cuePoint;
}); const cue = utils.createElement('span', {
cue.style.left = cuePoint.toString() + 'px'; class: this.player.config.classNames.cues,
seekElement.appendChild(cue); });
cue.style.left = `${cuePercentage.toString()}%`;
seekElement.appendChild(cue);
}
} }
}); });