修复直链播放时,测速组件预加载CORS报错的问题
This commit is contained in:
+18
-2
@@ -1415,11 +1415,18 @@ function PlayPageClient() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取当前集数的播放地址
|
// 获取当前集数的播放地址
|
||||||
const episodeUrl = detail.episodes[currentEpisodeIndex];
|
let episodeUrl = detail.episodes[currentEpisodeIndex];
|
||||||
if (!episodeUrl) {
|
if (!episodeUrl) {
|
||||||
return;
|
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 {
|
try {
|
||||||
const info = await getVideoResolutionFromM3u8(episodeUrl, 4000);
|
const info = await getVideoResolutionFromM3u8(episodeUrl, 4000);
|
||||||
setCurrentSourceVideoInfo(info);
|
setCurrentSourceVideoInfo(info);
|
||||||
@@ -1469,10 +1476,19 @@ function PlayPageClient() {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const episodeUrl =
|
let episodeUrl =
|
||||||
source.episodes.length > 1
|
source.episodes.length > 1
|
||||||
? source.episodes[1]
|
? source.episodes[1]
|
||||||
: source.episodes[0];
|
: 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);
|
const testResult = await getVideoResolutionFromM3u8(episodeUrl);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user