类型:开发
描述:
This commit is contained in:
@@ -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+'】' )
|
||||
|
||||
Reference in New Issue
Block a user