类型:开发

描述:
This commit is contained in:
2025-12-19 20:16:43 +08:00
parent aa18dc7a4c
commit c392ce026d
4 changed files with 61 additions and 15 deletions

View File

@@ -293,7 +293,11 @@ const onInput = debounce((e) => {
const clearHlsRefs = () => {
if (hlsRefs.length > 0) {
hlsRefs.map((item) => {
item.destroy()
try{
item.destroy()
}catch (e) {
}
})
hlsRefs = []
}
@@ -339,7 +343,12 @@ const handleNav = (e) => {
}
const handleBack = () => {
videoLog.value = 1
hlsRef.destroy()
try{
hlsRef.destroy()
}catch (e) {
}
initVideo()
}
let thisVideo = ref(null)
@@ -367,8 +376,12 @@ const handleItemVideo = async (url, type, code, item) => {
hlsRef.on('error', (err) => {
console.error('播放器错误:', err)
// 3 秒后尝试重新加载
hlsRef.unload()
hlsRef.destroy()
try{
hlsRef.unload()
hlsRef.destroy()
}catch (e) {
}
// 3 秒后尝试重新加载
setTimeout(() => {
console.error('重新加载【'+cameraIndexCode+'】' )
@@ -502,8 +515,13 @@ const createPlayer = (cameraIndexCode,videoElement) => {
// 错误处理和重连机制
player.on(mpegtsjs.Events.ERROR, (err) => {
console.error('播放器错误【'+cameraIndexCode+'】:', err)
player.unload();
player.destroy();
try{
player.unload();
player.destroy();
}catch (e) {
}
// 3 秒后尝试重新加载
setTimeout(() => {
console.error('重新加载【'+cameraIndexCode+'】' )