Skip to content

Commit

Permalink
fix(UI): Correctly display video time and duration for VOD (#5929)
Browse files Browse the repository at this point in the history
Fixes #5765
  • Loading branch information
avelad committed Nov 27, 2023
1 parent 628bb63 commit 00ff864
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ui/presentation_time.js
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 00ff864

Please sign in to comment.