From ec47c164b0e96c838ca6f34260f4ad91ff3f73ae Mon Sep 17 00:00:00 2001 From: wangzzpeng <1032675359@qq.com> Date: Fri, 26 Jun 2026 14:13:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=20=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=81=A2=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/video.ts | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/src/utils/video.ts b/src/utils/video.ts index b5947b6..de63ef7 100644 --- a/src/utils/video.ts +++ b/src/utils/video.ts @@ -25,8 +25,6 @@ export const initHls = (monitorVideoUrl, monitorVideoRef) => { manifestLoadingTimeOut: 5000, // m3u8 请求超时5秒 levelLoadingMaxRetry: 20, // ts 分片加载最多重试20次 levelLoadingRetryDelay: 500, - fragLoadingMaxRetry: 20, // 片段加载重试 - fragLoadingRetryDelay: 500, lowLatencyMode: false, // 关掉低延迟模式,更稳定 startLevel: -1 // 自动选择码率 }); @@ -40,28 +38,6 @@ export const initHls = (monitorVideoUrl, monitorVideoRef) => { // 加载成功,重置重试计数 // hlsRetryCount = 0; }); - - // ★ 错误自动恢复:hls.js 拿到空 m3u8 或 ts 加载失败时自动重试 - hls.on(Hls.Events.ERROR, (event, data) => { - if (data.fatal) { - switch (data.type) { - case Hls.ErrorTypes.NETWORK_ERROR: - hls.startLoad(); - ElMessage.error('网络错误, 请检查网络或重试'); - break; - case Hls.ErrorTypes.MEDIA_ERROR: - // 媒体解码错误 → 尝试恢复 - hls.recoverMediaError(); - break; - default: - // 其他致命错误 → 销毁,让下一次 initHls 重建 - hls.destroy(); - hlsInstance = null; - break; - } - } - }); - hlsInstance = hls; } else if (video.canPlayType('application/vnd.apple.mpegurl')) { // Safari/原生支持 HLS