feat hls分片加在成功后播放

This commit is contained in:
Ironsp
2026-07-20 10:22:52 +08:00
parent d78dd8d42e
commit 7f376ce10c
2 changed files with 6 additions and 4 deletions

View File

@@ -5,10 +5,6 @@
"ComputedRef": true,
"DirectiveBinding": true,
"EffectScope": true,
"ElLoading": true,
"ElMessage": true,
"ElMessageBox": true,
"ElNotification": true,
"ExtractDefaultPropTypes": true,
"ExtractPropTypes": true,
"ExtractPublicPropTypes": true,

View File

@@ -46,6 +46,12 @@ export const initHls = (monitorVideoUrl, monitorVideoRef, isDialogVisible?: () =
switch (data.type) {
case Hls.ErrorTypes.NETWORK_ERROR:
hls.startLoad();
hls.once(Hls.Events.FRAG_LOADED, () => {
//分片加载成功后播放
try {
video.play().catch(() => {});
} catch (e) {}
});
ElMessage.error('网络错误, 请检查网络或重试');
break;
case Hls.ErrorTypes.MEDIA_ERROR: