Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(UI): Correctly display video time and duration for VOD #5929

Merged
merged 1 commit into from
Nov 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions ui/presentation_time.js
Original file line number Diff line number Diff line change
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
Loading