类型:开发

描述:
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

8
package-lock.json generated
View File

@@ -25,7 +25,7 @@
"vue-router": "^4.4.5",
"vue3-seamless-scroll": "^2.0.1",
"vuedraggable": "^4.1.0",
"whepts": "^1.1.11"
"whepts": "^1.1.12"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.2.1",
@@ -6188,9 +6188,9 @@
"license": "MIT"
},
"node_modules/whepts": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/whepts/-/whepts-1.1.11.tgz",
"integrity": "sha512-NJ37rUXS4aeO36sxmSTxMZTGXdScedxdhAt7oKhFhzAeV/IjNCWdyu8d+fSGSEAPjJS4FnBzwSFLrENZjAqcRA==",
"version": "1.1.12",
"resolved": "https://registry.npmjs.org/whepts/-/whepts-1.1.12.tgz",
"integrity": "sha512-KllGslriMAhD6BDBbG6X653M8XgeYqxnjuEyaB7U/1nIZN6NoAGSWP3Av46g690r2UaaI69bNzfPn4efJBd+kA==",
"license": "MIT",
"dependencies": {
"eventemitter3": "^5.0.4",

View File

@@ -26,7 +26,7 @@
"vue-router": "^4.4.5",
"vue3-seamless-scroll": "^2.0.1",
"vuedraggable": "^4.1.0",
"whepts": "^1.1.11"
"whepts": "^1.1.12"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.2.1",

View File

@@ -176,6 +176,9 @@ export default {
this.initializePlayer();
}
})
this.hls.on('play:failed', (err) => {
this.initializePlayer();
})
}else{
this.hls = new Hls({
// 内存优化配置

View File

@@ -122,7 +122,8 @@
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/')){
@@ -137,6 +138,9 @@
createPlayer(cameraIndexCode,videoElement);
}
})
player.on('play:failed', (err) => {
createPlayer(cameraIndexCode,videoElement);
})
webrtcRefs.push(player)
}
else{

View File

@@ -92,7 +92,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

View File

@@ -246,7 +246,8 @@ const handleCamera = async (itemCode,resource,index) => {
show.value = true
let res = await getPreviewUrlApi({
type: 'hls',
cameraIndexCode:itemCode
cameraIndexCode:itemCode,
sub_stream: 0
})
cameraIndexCode.value = itemCode;
isCollect.value = resource.isCollect
@@ -297,7 +298,8 @@ const handleItemVideo = (url, type, code,item) => {
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/')){
@@ -312,6 +314,9 @@ const createPlayer = (cameraIndexCode,videoElement) => {
createPlayer(cameraIndexCode,videoElement);
}
})
player.on('play:failed', (err) => {
createPlayer(cameraIndexCode,videoElement);
})
webrtcRefs.push(player)
}
else{

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, // 最大缓冲长度(秒)

View File

@@ -258,7 +258,8 @@
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/')){
@@ -273,6 +274,9 @@
createPlayer(cameraIndexCode,videoElement);
}
})
player.on('play:failed', (err) => {
createPlayer(cameraIndexCode,videoElement);
})
webrtcRefs.push(player)
}
else{
@@ -393,7 +397,8 @@
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
@@ -416,6 +421,9 @@
handleItemVideo(url, type, code, item);
}
})
hlsRef.on('play:failed', (err) => {
handleItemVideo(url, type, code, item);
})
} else {
hlsRef = new Hls({
maxBufferLength: 10, // 最大缓冲长度(秒)
@@ -463,7 +471,8 @@
show.value = true
let res = await getPreviewUrlApi({
type: 'hls',
cameraIndexCode: itemCode
cameraIndexCode: itemCode,
subStream: 0
})
cameraIndexCode.value = itemCode;
isCollect.value = resource.isCollect

View File

@@ -191,7 +191,8 @@
const getPreviewUrl = async (code) => {
let res = await getPreviewUrlApi({
cameraIndexCode: code,
type: 'hls'
type: 'hls',
subStream:0
})
src.value = res.data.url
videoShow.value = true