From 1ad13ad47f1dbab00bc8c6946dde61be4c34b22a Mon Sep 17 00:00:00 2001 From: mtvpls Date: Sat, 20 Dec 2025 20:01:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=8D=E6=AC=A1=E5=B0=9D=E8=AF=95=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=88=87=E9=9B=86=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/play/page.tsx | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/app/play/page.tsx b/src/app/play/page.tsx index 8264d65..2081aca 100644 --- a/src/app/play/page.tsx +++ b/src/app/play/page.tsx @@ -2932,6 +2932,13 @@ function PlayPageClient() { // iOS需要等待DOM完全清理 await new Promise(resolve => setTimeout(resolve, 100)); + // 双重检查:如果旧播放器仍然存在,再次清理 + if (artPlayerRef.current) { + console.warn('旧播放器仍存在,再次清理'); + cleanupPlayer(); + await new Promise(resolve => setTimeout(resolve, 100)); + } + // 再次确保容器为空 if (artRef.current) { artRef.current.innerHTML = ''; @@ -3560,13 +3567,24 @@ function PlayPageClient() { (window.navigator as any).standalone === true; // 检查是否已经在原生全屏状态 - const isInNativeFullscreen = document.fullscreenElement !== null; + const isInNativeFullscreen = !!(document.fullscreenElement || (document as any).webkitFullscreenElement); // 如果已经在原生全屏状态,退出原生全屏 if (isInNativeFullscreen) { - document.exitFullscreen().catch((err: Error) => { - console.error('退出全屏失败:', err); - }); + const exitFullscreen = (document as any).exitFullscreen || + (document as any).webkitExitFullscreen || + (document as any).mozCancelFullScreen || + (document as any).msExitFullscreen; + if (exitFullscreen) { + try { + const result = exitFullscreen.call(document); + if (result && typeof result.catch === 'function') { + result.catch((err: Error) => console.error('退出全屏失败:', err)); + } + } catch (err) { + console.error('退出全屏失败:', err); + } + } return; }