类型:开发

描述:
This commit is contained in:
2026-02-03 10:14:46 +08:00
parent cee259db65
commit 724dc4a561
11 changed files with 55 additions and 22 deletions

View File

@@ -66,7 +66,8 @@ let isCollect = ref(0)
const handleItem = async (item) => {
let res = await getPreviewUrlApi({
cameraIndexCode: item.cameraIndexCode,
type: 'hls'
type: 'hls',
subStream:0
})
src.value = res.data.url
cameraIndexCode.value = item.cameraIndexCode
@@ -87,7 +88,8 @@ let isCollect = ref(0)
const getPreviewUrl = async (code) => {
let res = await getPreviewUrlApi({
cameraIndexCode: code,
type: 'hls'
type: 'hls',
subStream:1
})
src.value = res.data.url
videoShow.value = true
@@ -95,7 +97,8 @@ let isCollect = ref(0)
const createPlayer = (cameraIndexCode,videoElement) => {
getPreviewUrlApi({
type: 'hls',
cameraIndexCode: cameraIndexCode
cameraIndexCode: cameraIndexCode,
subStream:0
}).then(res=>{
const url = res.data.url;
if(url.startsWith('http://192.168.77.200:8050/')){
@@ -105,11 +108,13 @@ let isCollect = ref(0)
iceServers: [{ urls: 'turn:192.168.77.200:3478',username: 'ZLMediaKit',credential: 'ZLMediaKit'}]
})
player.on('error', (error) => {
console.error('错误:', error.message, error.type)
if(error.type ==='REQUEST_ERROR' || error.type ==='NOT_FOUND_ERROR'){
createPlayer(cameraIndexCode,videoElement);
}
})
player.on('play:failed', (err) => {
createPlayer(cameraIndexCode,videoElement);
})
webrtcRefs.push(player)
}
else{