From e3def7d01b47dea7daf42ed1959c9664a169bcca Mon Sep 17 00:00:00 2001 From: Developer Date: Wed, 25 Mar 2026 15:03:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=B0=8F=E7=AA=97?= =?UTF-8?q?=E9=97=AD=E5=8C=85=E8=BF=87=E6=9C=9F=E3=80=81=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=A1=B5=20loading=20=E5=8D=A1=E6=AD=BB=E3=80=81=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E6=92=AD=E6=94=BE=E5=99=A8=E6=80=A7=E8=83=BD=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 小窗 PanResponder 用 storeRef 替代闭包捕获,修复 roomId/bvid 始终为初始值 - useLiveDetail 用 ref 比对替代 cancelled 标志,防止 fetch 被意外取消 - 详情页 useLayoutEffect 同步清除小窗,BigVideoCard 小窗活跃时跳过播放 - 视频播放器竖屏/全屏互斥渲染,减半解码器占用 - onProgress 节流 + 退出全屏强制恢复播放 --- CHANGELOG.md | 17 +++++++ app/downloads.tsx | 31 ++++-------- app/live/[roomId].tsx | 19 ++++---- app/video/[bvid].tsx | 8 +++- components/BigVideoCard.tsx | 15 +++--- components/DanmakuList.tsx | 9 ++-- components/LiveMiniPlayer.tsx | 9 +++- components/MiniPlayer.tsx | 12 +++-- components/NativeVideoPlayer.tsx | 30 +++++++----- components/VideoPlayer.tsx | 82 ++++++++++++++++---------------- hooks/useLiveDetail.ts | 33 ++++++++----- 11 files changed, 147 insertions(+), 118 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 425ff5e..5971114 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,23 @@ --- +## [1.0.13] - 2026-03-25 + +### 修复 +- **小窗 PanResponder 闭包过期**:`useRef(PanResponder.create(...))` 捕获初始 `roomId=0` / `bvid=""`,导致点击小窗跳转到错误页面;改用 `storeRef` 模式保持最新值 +- **直播小窗进入详情无限 loading**:`useLiveDetail` 使用 `cancelled` 闭包标志,effect cleanup 后 fetch 被静默丢弃;改用 `latestRoomId` ref 比对替代 cancelled 模式 +- **进入播放器页面小窗不关闭**:视频/直播详情页进入时通过 `useLayoutEffect` + `getState().clearLive()` 同步清除小窗,避免双播和资源竞争 +- **BigVideoCard 与直播小窗冲突**:首页 BigVideoCard 自动播放与直播小窗竞争解码器资源;小窗活跃时跳过 Video 渲染,仅显示封面图 +- **退出全屏视频暂停**:互斥渲染后竖屏播放器重新挂载,react-native-video seek 后不自动恢复播放;`onLoad` 中强制 `paused` 状态切换触发播放 + +### 优化 +- **视频播放器单实例**:竖屏/全屏互斥渲染(`{!fullscreen && ...}` / `{fullscreen && ...}`),不再同时挂载两个 Video 解码器,减半 GPU/内存占用 +- **onProgress 节流**:`progressUpdateInterval` 从 250ms 调为 500ms,回调内增加 450ms 节流和 seeking 跳过,减少重渲染 +- **移除调试日志**:清理 NativeVideoPlayer 中遗留的 `console.log` +- **下载页 UI 优化**:下载管理页交互和暗黑主题适配 + +--- + ## [1.0.12] - 2026-03-25 ### 新增 diff --git a/app/downloads.tsx b/app/downloads.tsx index 51dccf2..f1620a3 100644 --- a/app/downloads.tsx +++ b/app/downloads.tsx @@ -8,7 +8,6 @@ import { Image, Modal, StatusBar, - useWindowDimensions, Alert, } from 'react-native'; import { SafeAreaView } from 'react-native-safe-area-context'; @@ -36,14 +35,10 @@ export default function DownloadsScreen() { const [playingUri, setPlayingUri] = useState(null); const [playingTitle, setPlayingTitle] = useState(''); const [shareTask, setShareTask] = useState<(DownloadTask & { key: string }) | null>(null); - const [showControls, setShowControls] = useState(true); - const { width, height } = useWindowDimensions(); - const isLandscape = width > height; async function openPlayer(uri: string, title: string) { setPlayingTitle(title); setPlayingUri(uri); - setShowControls(true); await ScreenOrientation?.unlockAsync(); } @@ -133,29 +128,23 @@ export default function DownloadsScreen() { onRequestClose={closePlayer} >