From 1db6a1e19c7a4d1f563ea39ac828f81cf29c0ea0 Mon Sep 17 00:00:00 2001 From: callmeyan Date: Thu, 13 Feb 2025 17:44:05 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E8=B0=83=E6=95=B4=E7=9B=B4=E6=92=AD?= =?UTF-8?q?=E9=97=B4=E6=97=B6=E9=95=BFUI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/live/index.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pages/live/index.tsx b/src/pages/live/index.tsx index a6d5a4d..40f0964 100644 --- a/src/pages/live/index.tsx +++ b/src/pages/live/index.tsx @@ -190,6 +190,9 @@ export default function LiveIndex() { // 计算总时长 return videoData.reduce((sum, v) => sum + Math.ceil(v.video_duration / 1000), 0); }, [videoData]) + const currentVideoDuration = useMemo(()=>{ + return state.activeIndex <0 || state.activeIndex > videoData.length - 1 ? 0 : videoData[state.activeIndex].video_duration / 1000; + },[state.activeIndex, videoData]) // 根据当前播放index计算已经播放时长 const currentTotalDuration = useMemo(() => { if (state.activeIndex == -1 || !videoData || videoData.length == 0) return 0; @@ -216,7 +219,7 @@ export default function LiveIndex() {
-
{t('live.title')}
+
{formatDuration(totalDuration)}
@@ -230,7 +233,7 @@ export default function LiveIndex() {
- {t('live.duration')}: {formatDuration(currentTotalDuration)} / {formatDuration(totalDuration)} + {t('live.duration')}: {formatDuration(state.playProgress)} / {formatDuration(currentVideoDuration)}