diff --git a/static/player.ts b/static/player.ts index 6fedbb3..b29acfe 100644 --- a/static/player.ts +++ b/static/player.ts @@ -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 => { diff --git a/templates/components/video_player.gohtml b/templates/components/video_player.gohtml index 6c2fb08..bc23dc7 100644 --- a/templates/components/video_player.gohtml +++ b/templates/components/video_player.gohtml @@ -87,11 +87,11 @@
0:00
-
-
-
+
+
+
-
+
0:00