From b4320b7028e39565828f0f106f799030a0b7c0ad Mon Sep 17 00:00:00 2001 From: Troray Date: Tue, 10 Mar 2026 17:50:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=9B=B4=E9=93=BE=E6=92=AD?= =?UTF-8?q?=E6=94=BE=E6=97=B6,=E6=B5=8B=E9=80=9F=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E9=A2=84=E5=8A=A0=E8=BD=BDCORS=E6=8A=A5=E9=94=99=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/play/page.tsx | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/app/play/page.tsx b/src/app/play/page.tsx index f44aabc..2a0d683 100644 --- a/src/app/play/page.tsx +++ b/src/app/play/page.tsx @@ -1415,11 +1415,18 @@ function PlayPageClient() { } // 获取当前集数的播放地址 - const episodeUrl = detail.episodes[currentEpisodeIndex]; + let episodeUrl = detail.episodes[currentEpisodeIndex]; if (!episodeUrl) { return; } + if (currentSource === 'directplay') { + const tokenParam = proxyToken ? `&token=${encodeURIComponent(proxyToken)}` : ''; + episodeUrl = `/api/proxy-m3u8?url=${encodeURIComponent(episodeUrl)}&source=directplay${tokenParam}`; + } else if (sourceProxyMode) { + episodeUrl = `/api/proxy/vod/m3u8?url=${encodeURIComponent(episodeUrl)}&source=${encodeURIComponent(currentSource)}`; + } + try { const info = await getVideoResolutionFromM3u8(episodeUrl, 4000); setCurrentSourceVideoInfo(info); @@ -1469,10 +1476,19 @@ function PlayPageClient() { return null; } - const episodeUrl = + let episodeUrl = source.episodes.length > 1 ? source.episodes[1] : source.episodes[0]; + + // 对优选源进行测速时也需要考虑代理情况 + if (source.source === 'directplay') { + const tokenParam = proxyToken ? `&token=${encodeURIComponent(proxyToken)}` : ''; + episodeUrl = `/api/proxy-m3u8?url=${encodeURIComponent(episodeUrl)}&source=directplay${tokenParam}`; + } else if (source.proxyMode) { + episodeUrl = `/api/proxy/vod/m3u8?url=${encodeURIComponent(episodeUrl)}&source=${encodeURIComponent(source.source)}`; + } + const testResult = await getVideoResolutionFromM3u8(episodeUrl); return {