From 75fe39ca0ba0c08aea0341d8fb2d8e8ca321ca29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A=CC=81lvaro=20Velad=20Galva=CC=81n?= Date: Fri, 24 Nov 2023 14:27:49 +0100 Subject: [PATCH] fix(UI): Correctly display video time and duration for VOD --- ui/presentation_time.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ui/presentation_time.js b/ui/presentation_time.js index 721ef747b6..a105702089 100644 --- a/ui/presentation_time.js +++ b/ui/presentation_time.js @@ -64,7 +64,6 @@ shaka.ui.PresentationTimeTracker = class extends shaka.ui.Element { updateTime_() { const isSeeking = this.controls.isSeeking(); let displayTime = this.controls.getDisplayTime(); - const duration = this.video.duration; const seekRange = this.player.seekRange(); const seekRangeSize = seekRange.end - seekRange.start; const Utils = shaka.ui.Utils; @@ -89,11 +88,12 @@ shaka.ui.PresentationTimeTracker = class extends shaka.ui.Element { this.currentTime_.disabled = true; } } else { - const showHour = duration >= 3600; + const showHour = seekRangeSize >= 3600; - let value = Utils.buildTimeString(displayTime, showHour); - if (duration) { - value += ' / ' + Utils.buildTimeString(duration, showHour); + const currentTime = Math.max(0, displayTime - seekRange.start); + let value = Utils.buildTimeString(currentTime, showHour); + if (seekRangeSize) { + value += ' / ' + Utils.buildTimeString(seekRangeSize, showHour); } this.setValue_(value); this.currentTime_.disabled = true;