类型:开发
描述:
This commit is contained in:
@@ -528,7 +528,7 @@
|
||||
if(val==3){
|
||||
params.businessVideoDisplayPosition = ''
|
||||
}else{
|
||||
params.businessVideoDisplayPosition = navList.value[current.value].dictValue
|
||||
params.businessVideoDisplayPosition = navList.value[current.value]
|
||||
}
|
||||
|
||||
let res = await getVideoListApi(params)
|
||||
@@ -536,46 +536,10 @@
|
||||
if (res.data.length > 0) {
|
||||
|
||||
videoList.value = res.data
|
||||
// console.log(videoList.value,'1111111111111111111111')
|
||||
// postVideoRemain()
|
||||
nextTick(() => {
|
||||
videoList.value.forEach(async (x, index) => {
|
||||
const video = document.getElementById(`monitorVideo${index}`)
|
||||
const hls = new Hls({
|
||||
maxBufferLength: 10, // 最大缓冲长度(秒)
|
||||
maxMaxBufferLength: 15, // 缓冲区长度的上限
|
||||
maxBufferSize: 30 * 1000 * 1000 // 最大缓冲大小(字节)
|
||||
})
|
||||
hls.loadSource(x.hlsUrl)
|
||||
hls.attachMedia(video)
|
||||
hls.on(Hls.Events.MANIFEST_PARSED, () => {
|
||||
video.play()
|
||||
})
|
||||
hls.on(Hls.Events.ERROR, (event, data) => {
|
||||
// console.error('HLS 播放器遇到错误:', data);
|
||||
// hls.startLoad();
|
||||
// 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)
|
||||
const videoElement = document.getElementById(`monitorVideo${index}`)
|
||||
createPlayer(x.cameraIndexCode,videoElement);
|
||||
})
|
||||
})
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user