ui(video_player): fix time display and skip segment progress bar thickness

This commit is contained in:
2026-05-01 17:35:22 +02:00
committed by Mikkel Elvers
parent 4f3a61e143
commit b243d9aebb
2 changed files with 9 additions and 6 deletions

View File

@@ -72,6 +72,7 @@ const initPlayer = (): void => {
const iconMuted = container.querySelector('[data-icon-muted]') as SVGElement
const volumeUnderline = container.querySelector('[data-volume-underline]') as HTMLElement
const timeDisplay = container.querySelector('[data-time]') as HTMLElement
const durationDisplay = container.querySelector('[data-duration]') as HTMLElement
const progressWrap = container.querySelector('[data-progress-wrap]') as HTMLElement
const progress = container.querySelector('[data-progress]') as HTMLElement
const scrubber = container.querySelector('[data-scrubber]') as HTMLElement
@@ -355,7 +356,8 @@ const initPlayer = (): void => {
if (bounds.duration <= 0) {
progress.style.width = '0%'
if (scrubber) scrubber.style.left = '0%'
timeDisplay.textContent = `00:00 / 00:00`
timeDisplay.textContent = '00:00'
if (durationDisplay) durationDisplay.textContent = '00:00'
return
}
@@ -363,7 +365,8 @@ const initPlayer = (): void => {
const pct = Math.max(0, Math.min(100, (currentDisplayTime / bounds.duration) * 100))
progress.style.width = `${pct}%`
if (scrubber) scrubber.style.left = `${pct}%`
timeDisplay.textContent = `${formatTime(currentDisplayTime)} / ${formatTime(bounds.duration)}`
timeDisplay.textContent = formatTime(currentDisplayTime)
if (durationDisplay) durationDisplay.textContent = formatTime(bounds.duration)
}
const seekBy = (delta: number): void => {