From b21bd3d7918dca4858635b93e99c29062dba9713 Mon Sep 17 00:00:00 2001 From: duanliang Date: Wed, 2 Apr 2025 13:11:34 +0800 Subject: [PATCH] 4.2 --- src/views/monitor/components/box-2.vue | 27 ++++++++------------------ 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/src/views/monitor/components/box-2.vue b/src/views/monitor/components/box-2.vue index cf38cb2..054d575 100644 --- a/src/views/monitor/components/box-2.vue +++ b/src/views/monitor/components/box-2.vue @@ -263,31 +263,20 @@ getVideoList() } const getColletList = async () => { + clearHlsRefs() + params.businessVideoDisplayPosition = '' let res = await getColletListApi(params) videoList.value = res.data + if(res.data.length){ + postVideoRemain() + } total.value = res.total nextTick(() => { - videoList.value.forEach(async (item, index) => { - var video = document.getElementById(`video${index}`) - const hls = new Hls({ - enableWorker: false, // 禁用 Worker 来避免额外的线程 - enableSoftwareAES: true, // 使用软件解码器以避免硬件解码的额外请求 - cache: true, // 启用缓存 - maxBufferLength: 10, // 最大缓冲长度(秒) - maxMaxBufferLength: 15, // 缓冲区长度的上限 - maxBufferSize: 20 * 1000 * 1000 // 最大缓冲大小(字节) - }) - console.log(item.hlsUrl); - hls.loadSource(item.hlsUrl) - hls.attachMedia(video) - hls.on(Hls.Events.MANIFEST_PARSED, () => { - video.play() - }) - hlsRefs.push(hls) - }) + initVideo() }) } const handleNav = (e) => { + clearInterval(timer) if (current.value == e) return clearHlsRefs() videoLog.value = 1 @@ -383,7 +372,7 @@ let res = await getVideoListApi(params) total.value = res.total if (res.data.length > 0) { - // postVideoRemain() + postVideoRemain() videoList.value = res.data nextTick(() => { videoList.value.forEach(async (x, index) => {