From 670ec90d8baf673dd0907523fce095af9b306b3b Mon Sep 17 00:00:00 2001 From: orangelckc <276126767@qq.com> Date: Mon, 18 Dec 2023 22:11:33 +0100 Subject: [PATCH] =?UTF-8?q?perf:=20=E7=9B=B4=E6=92=AD=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Robot/video.vue | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/views/Robot/video.vue b/src/views/Robot/video.vue index 0541093..a493b78 100644 --- a/src/views/Robot/video.vue +++ b/src/views/Robot/video.vue @@ -43,7 +43,7 @@ const initPlayer = () => { { enableWorker: false, // 不启用拆散线程 enableStashBuffer: false, // 敞开IO暗藏缓冲区 - reuseRedirectedURL: true, // 重用301/302重定向url,用于随后的申请,如查找、重新连接等。 + reuseRedirectedURL: false, // 重用301/302重定向url,用于随后的申请,如查找、重新连接等。 autoCleanupSourceBuffer: true // 主动清除缓存 } ); @@ -51,6 +51,10 @@ const initPlayer = () => { flvPlayer.load(); flvPlayer.play(); + flvPlayer.on(flvjs.Events.METADATA_ARRIVED, (data: any) => { + console.log('视频流加载成功',data) + }); + flvPlayer.on(flvjs.Events.LOADING_COMPLETE, (data: any) => { message("视频流停止"); destroyPlayer(); @@ -117,9 +121,9 @@ watchEffect(async () => { await destroyPlayer(); curStreamIndex = 0; - curStream.value = props.streams[curStreamIndex]; - // 优先m3u8 - // curStream.value = props.streams.find(item => item.type === 'm3u8'); + // 优先flv,m3u8有地域限制 + curStream.value = props.streams.find(item => item.type === 'flv') || props.streams[curStreamIndex]; + console.log('curStream.value',curStream.value) }) const switchPlay = () => { @@ -136,14 +140,13 @@ const switchPlay = () => {