From a7707dc9917a3be2238cd9fd1f7cc2f2a718a99c Mon Sep 17 00:00:00 2001 From: mtvpls Date: Fri, 22 May 2026 00:53:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=92=AD=E6=94=BE=E8=AE=B0=E5=BD=95=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E5=8E=BB=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/play/page.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/app/play/page.tsx b/src/app/play/page.tsx index 4ad3b5b..87633ac 100644 --- a/src/app/play/page.tsx +++ b/src/app/play/page.tsx @@ -1773,6 +1773,7 @@ function PlayPageClient() { // 播放进度保存相关 const saveIntervalRef = useRef(null); const lastSaveTimeRef = useRef(0); + const lastSavedPlayTimeRef = useRef(null); // 下集预缓存相关 const nextEpisodePreCacheTriggeredRef = useRef(false); @@ -5703,12 +5704,17 @@ function PlayPageClient() { const player = artPlayerRef.current; const currentTime = player.currentTime || 0; const duration = player.duration || 0; + const playTime = Math.floor(currentTime); // 如果播放时间太短(少于5秒)或者视频时长无效,不保存 if (currentTime < 1 || !duration) { return; } + if (lastSavedPlayTimeRef.current === playTime) { + return; + } + try { saveLocalEpisodeProgress( episodeProgressContentKey, @@ -5724,12 +5730,13 @@ function PlayPageClient() { cover: detailRef.current?.poster || '', index: currentEpisodeIndexRef.current + 1, // 转换为1基索引 total_episodes: detailRef.current?.episodes.length || 1, - play_time: Math.floor(currentTime), + play_time: playTime, total_time: Math.floor(duration), save_time: Date.now(), search_title: searchTitle, }); + lastSavedPlayTimeRef.current = playTime; lastSaveTimeRef.current = Date.now(); console.log('播放进度已保存:', { title: videoTitleRef.current,