From e54ec1a9022a42949af3e6b5c702ceabb0fa97f3 Mon Sep 17 00:00:00 2001 From: mtvpls Date: Sun, 11 Jan 2026 22:12:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=B0=8F=E9=9B=85=E7=BA=A0?= =?UTF-8?q?=E9=94=99=E4=B8=8D=E6=9B=B4=E6=96=B0=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/play/page.tsx | 33 ++++++++++++------------------ src/components/EpisodeSelector.tsx | 1 + 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/app/play/page.tsx b/src/app/play/page.tsx index c624917..bc446b4 100644 --- a/src/app/play/page.tsx +++ b/src/app/play/page.tsx @@ -3928,28 +3928,21 @@ function PlayPageClient() { if (correction) { console.log('应用纠错信息:', correction); - // 只更新显示相关的状态,不更新 detail(避免触发播放器刷新) - if (correction.title) { - setVideoTitle(correction.title); - } - if (correction.posterPath) { - // 补全 TMDB 图片 URL - const fullPosterUrl = getTMDBImageUrl(correction.posterPath); - setVideoCover(fullPosterUrl); - } - if (correction.doubanId) { - const doubanIdNum = typeof correction.doubanId === 'string' - ? parseInt(correction.doubanId, 10) - : correction.doubanId; - setVideoDoubanId(doubanIdNum); + // 应用纠错信息到 detail + const updatedDetail = applyCorrection(detail, correction); + + // 更新所有相关状态 + setDetail(updatedDetail); + setVideoTitle(updatedDetail.title); + setVideoCover(updatedDetail.poster); + if (updatedDetail.douban_id) { + setVideoDoubanId(updatedDetail.douban_id); } - // 更新 detailRef,这样其他地方使用 detailRef 时能获取到最新信息 - if (detailRef.current) { - detailRef.current = applyCorrection(detailRef.current, correction); - } + // 更新 detailRef + detailRef.current = updatedDetail; - console.log('已应用纠错信息(页面刷新后将完全生效)'); + console.log('已应用纠错信息到当前视频详情:', updatedDetail); } }; @@ -5964,7 +5957,7 @@ function PlayPageClient() { // 调用异步初始化函数 initPlayer(); - }, [videoUrl, loading, blockAdEnabled, currentEpisodeIndex, detail]); + }, [videoUrl, loading, blockAdEnabled, currentEpisodeIndex, detail?.subtitles]); // 当组件卸载时清理定时器、Wake Lock 和播放器资源 useEffect(() => { diff --git a/src/components/EpisodeSelector.tsx b/src/components/EpisodeSelector.tsx index 18b855d..e9bdd34 100644 --- a/src/components/EpisodeSelector.tsx +++ b/src/components/EpisodeSelector.tsx @@ -214,6 +214,7 @@ const EpisodeSelector: React.FC = ({ quality: '错误', loadSpeed: '未知', pingTime: 0, + bitrate: '未知', hasError: true, }) );