aboutsummaryrefslogtreecommitdiffstats
path: root/src/js
diff options
context:
space:
mode:
Diffstat (limited to 'src/js')
-rw-r--r--src/js/plugins/ads.js13
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);
+ }
}
});