类型:开发

描述:
This commit is contained in:
2026-02-03 10:29:49 +08:00
parent c0012f5305
commit 5301a74ec9
9 changed files with 48 additions and 17 deletions

View File

@@ -303,7 +303,8 @@ const handleCamera = async (itemCode,resource) => {
show.value = true
let res = await getPreviewUrlApi({
type: 'hls',
cameraIndexCode:itemCode
cameraIndexCode:itemCode,
subStream:0
})
cameraIndexCode.value = itemCode;
isCollect.value = resource.isCollect
@@ -339,7 +340,8 @@ const currentChange = (e) => {
const createPlayer = (cameraIndexCode,videoElement) => {
getPreviewUrlApi({
type: 'hls',
cameraIndexCode: cameraIndexCode
cameraIndexCode: cameraIndexCode,
subStream:1
}).then(res=>{
const url = res.data.url;
if(url.startsWith('http://192.168.77.200:8050/')){
@@ -354,7 +356,9 @@ const createPlayer = (cameraIndexCode,videoElement) => {
createPlayer(cameraIndexCode,videoElement);
}
})
player.on('play:failed', (err) => {
createPlayer(cameraIndexCode,videoElement);
})
webrtcRefs.push(player)
}
else{
@@ -424,7 +428,8 @@ let thisVideo = ref(null)
const handleItemVideo = async (url, type, code, item) => {
let res = await getPreviewUrlApi({
cameraIndexCode: code,
type: 'hls'
type: 'hls',
subStream:0
})
url = res.data.url
thisVideo.value = item
@@ -447,6 +452,9 @@ const handleItemVideo = async (url, type, code, item) => {
handleItemVideo(url, type, code, item);
}
})
hlsRef.on('play:failed', (err) => {
handleItemVideo(url, type, code, item);
})
} else {
hlsRef = new Hls({
maxBufferLength: 10, // 最大缓冲长度(秒)