类型:开发

描述:
This commit is contained in:
2026-02-04 17:26:47 +08:00
parent 6fe84fe853
commit 87c115ab99

View File

@@ -1,25 +1,6 @@
<template> <template>
<div class="video-box"> <div class="video-box">
<div class="left-nav"> <div class="left-nav">
<div v-if="showNav" class="ul">
<div
class="li"
:class="{ active: current == index }"
v-for="(item, index) in navList"
:key="index"
@click="handleNav(index)"
>
<span v-if="!params.businessScenicArea && index == 0"> 核心路段 </span>
<span v-else>
{{ item.dictLabel }}
</span>
</div>
<div
:class="{ active: current == 3 }"
@click="handleNav(3)" class="li">
<span>自定义</span>
</div>
</div>
<div class="bom-box"> <div class="bom-box">
<Title2 title="检索" /> <Title2 title="检索" />
<div class="search-box"> <div class="search-box">
@@ -76,16 +57,17 @@
@click.stop="handleCollect(item.cameraIndexCode, item.isCollect, index)" @click.stop="handleCollect(item.cameraIndexCode, item.isCollect, index)"
>关注 >关注
</div> </div>
<video <video
class="video-item__video" :id="'hotelmonitorVideo' + index"
:id="'hotelmonitorVideo' + index" preload="auto"
preload="auto" class="video-item__video"
muted muted
autoplay autoplay
:controls="false" :controls="false"
> >
<source type="application/x-mpegURL" />
</video> <source type="application/x-mpegURL"/>
</video>
<p class="video-item__title--primary"> <p class="video-item__title--primary">
{{ item.cameraName || item.cameraIndexCode }} {{ item.cameraName || item.cameraIndexCode }}
</p> </p>
@@ -342,9 +324,10 @@
getPreviewUrlApi({ getPreviewUrlApi({
type: 'hls', type: 'hls',
cameraIndexCode: cameraIndexCode, cameraIndexCode: cameraIndexCode,
subStream:1 subStream:0
}).then(res=>{ }).then(res=>{
const url = res.data.url; const url = res.data.url;
console.log('url',url)
if(url.startsWith('http://192.168.77.200:8050/')){ if(url.startsWith('http://192.168.77.200:8050/')){
const player = new WebRTCWhep({ const player = new WebRTCWhep({
url:url, // WHEP 服务器地址 url:url, // WHEP 服务器地址
@@ -358,6 +341,7 @@
} }
}) })
player.on('play:failed', (err) => { player.on('play:failed', (err) => {
console.error('错误:',err)
// createPlayer(cameraIndexCode,videoElement); // createPlayer(cameraIndexCode,videoElement);
}) })
webrtcRefs.push(player) webrtcRefs.push(player)
@@ -438,6 +422,7 @@
cameraIndexCode.value = code cameraIndexCode.value = code
setTimeout(() => { setTimeout(() => {
if (url.startsWith('http://192.168.77.200:8050/')) { if (url.startsWith('http://192.168.77.200:8050/')) {
console.error(1111111111)
if(hlsRef){ if(hlsRef){
hlsRef.updateUrl(url); hlsRef.updateUrl(url);
}else{ }else{
@@ -454,6 +439,7 @@
} }
}) })
hlsRef.on('play:failed', (err) => { hlsRef.on('play:failed', (err) => {
console.log('播放失败,尝试重新加载');
// handleItemVideo(url, type, code, item); // handleItemVideo(url, type, code, item);
}) })
} else { } else {