417
This commit is contained in:
@@ -323,6 +323,27 @@
|
||||
hls.on(Hls.Events.MANIFEST_PARSED, () => {
|
||||
video.play()
|
||||
})
|
||||
hls.on(Hls.Events.ERROR, (event, data) => {
|
||||
console.error('HLS 播放器遇到错误:', data);
|
||||
// 根据错误类型进行处理
|
||||
// initVideo()
|
||||
if (data.fatal) {
|
||||
switch (data.type) {
|
||||
case Hls.ErrorTypes.NETWORK_ERROR:
|
||||
console.log('网络错误,尝试重新加载');
|
||||
hls.startLoad();
|
||||
break;
|
||||
case Hls.ErrorTypes.MEDIA_ERROR:
|
||||
console.log('媒体错误,尝试修复');
|
||||
hls.recoverMediaError();
|
||||
break;
|
||||
default:
|
||||
console.log('无法恢复的错误,销毁播放器');
|
||||
hls.destroy();
|
||||
break;
|
||||
}
|
||||
}
|
||||
})
|
||||
hlsRefs.push(hls)
|
||||
})
|
||||
})
|
||||
@@ -373,23 +394,31 @@
|
||||
})
|
||||
})
|
||||
}
|
||||
watch(
|
||||
() => videoList.value,
|
||||
(val) => {
|
||||
if (val.length) {
|
||||
postVideoRemain()
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
// 更新视频
|
||||
const postVideoRemain = async () => {
|
||||
timer = setInterval(() => {
|
||||
postVideoRemainApi({
|
||||
cameraIndexCode: videoList.value.map((item) => item.cameraIndexCode)
|
||||
})
|
||||
}, 3000)
|
||||
}, 1500)
|
||||
}
|
||||
const getVideoRegions = async () => {
|
||||
console.log(params.businessScenicArea,7788888)
|
||||
let res = await getVideoRegionsApi({
|
||||
cameraName: cameraName.value,
|
||||
businessScenicArea: params.businessScenicArea
|
||||
})
|
||||
regionList.value = res.data
|
||||
regionList.value[0].show = true
|
||||
console.log(regionList.value, ' regionList.value')
|
||||
|
||||
}
|
||||
const handleRegions = (e) => {
|
||||
regionList.value[e].show = !regionList.value[e].show
|
||||
@@ -400,9 +429,10 @@
|
||||
let hotelChange = null;
|
||||
onMounted(()=>{
|
||||
hotelChange = pubSub.subscribe('hotelChange', (msg, data) => {
|
||||
cameraName.value = ''
|
||||
params.businessScenicArea = data.name
|
||||
getVideoRegions()
|
||||
console.log(data,'777888888')
|
||||
|
||||
})
|
||||
onMonitorChange()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user