From df437ce4ab5aabf3a4a0148b8c0f1d6ef51bf8fd Mon Sep 17 00:00:00 2001 From: kuekhaoyang Date: Tue, 18 Nov 2025 13:12:16 +0800 Subject: [PATCH] feat: update time formatting in DesktopVideoPlayer and MobileVideoPlayer to include hours --- components/player/DesktopVideoPlayer.tsx | 7 ++++--- components/player/MobileVideoPlayer.tsx | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/components/player/DesktopVideoPlayer.tsx b/components/player/DesktopVideoPlayer.tsx index c3bfe29..5bf4da2 100644 --- a/components/player/DesktopVideoPlayer.tsx +++ b/components/player/DesktopVideoPlayer.tsx @@ -549,10 +549,11 @@ export function DesktopVideoPlayer({ // Format time helper const formatTime = (seconds: number) => { - if (isNaN(seconds)) return '0:00'; - const mins = Math.floor(seconds / 60); + if (isNaN(seconds)) return '0:00:00'; + const hours = Math.floor(seconds / 3600); + const mins = Math.floor((seconds % 3600) / 60); const secs = Math.floor(seconds % 60); - return `${mins}:${secs.toString().padStart(2, '0')}`; + return `${hours}:${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`; }; return ( diff --git a/components/player/MobileVideoPlayer.tsx b/components/player/MobileVideoPlayer.tsx index 7237850..31a8b8b 100644 --- a/components/player/MobileVideoPlayer.tsx +++ b/components/player/MobileVideoPlayer.tsx @@ -401,10 +401,11 @@ export function MobileVideoPlayer({ const speeds = [0.5, 0.75, 1, 1.25, 1.5, 2]; const formatTime = (seconds: number) => { - if (isNaN(seconds)) return '0:00'; - const mins = Math.floor(seconds / 60); + if (isNaN(seconds)) return '0:00:00'; + const hours = Math.floor(seconds / 3600); + const mins = Math.floor((seconds % 3600) / 60); const secs = Math.floor(seconds % 60); - return `${mins}:${secs.toString().padStart(2, '0')}`; + return `${hours}:${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`; }; return (