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() {