feat(play): 直链播放默认不走代理及无后缀流透传兼容

1. 将直链播放(directplay)模式默认改为浏览器直连播放。
2. 播放失败UI新增'使用代理播放'按钮,点击后自动记忆域名并使用代理重试。
3. 仅在 localStorage 中记录的失败域名会自动走代理。
This commit is contained in:
Troray
2026-03-11 17:11:44 +08:00
parent 559117076c
commit 11dd787e73
3 changed files with 156 additions and 10 deletions
+16
View File
@@ -316,6 +316,22 @@ export async function getVideoResolutionFromM3u8(
hls.on(Hls.Events.ERROR, (event: any, data: any) => {
console.error('HLS错误:', data);
if (data.fatal) {
const statusCode = data.response?.code || data.response?.status;
// 防止 415 代理兜底熔断导致正常的二进制源在优选逻辑中被剔除
if (statusCode === 415 && (m3u8Url.includes('/api/proxy-m3u8') || m3u8Url.includes('/api/proxy/vod/m3u8'))) {
console.log('[测速] 测速通道嗅探到这是底层的媒体流文件,免测速通过');
clearTimeout(timeout);
hls.destroy();
video.remove();
resolve({
quality: '原生画质',
loadSpeed: '直连',
pingTime: 10,
bitrate: '未知',
});
return;
}
clearTimeout(timeout);
hls.destroy();
video.remove();