类型:开发

描述:
This commit is contained in:
2025-12-10 11:53:45 +08:00
parent 69213dac03
commit 3c255f9623
3 changed files with 26 additions and 39 deletions

22
package-lock.json generated
View File

@@ -15,6 +15,7 @@
"hls.js": "^1.5.18", "hls.js": "^1.5.18",
"jssip": "^3.10.1", "jssip": "^3.10.1",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"mpegts.js": "^1.8.0",
"pinia": "^2.2.6", "pinia": "^2.2.6",
"pinia-plugin-persistedstate": "^4.2.0", "pinia-plugin-persistedstate": "^4.2.0",
"pubsub-js": "^1.9.5", "pubsub-js": "^1.9.5",
@@ -3201,6 +3202,12 @@
"node": ">= 0.4" "node": ">= 0.4"
} }
}, },
"node_modules/es6-promise": {
"version": "4.2.8",
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz",
"integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==",
"license": "MIT"
},
"node_modules/esbuild": { "node_modules/esbuild": {
"version": "0.25.1", "version": "0.25.1",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.1.tgz", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.1.tgz",
@@ -4272,6 +4279,16 @@
"ufo": "^1.5.4" "ufo": "^1.5.4"
} }
}, },
"node_modules/mpegts.js": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/mpegts.js/-/mpegts.js-1.8.0.tgz",
"integrity": "sha512-ZtujqtmTjWgcDDkoOnLvrOKUTO/MKgLHM432zGDI8oPaJ0S+ebPxg1nEpDpLw6I7KmV/GZgUIrfbWi3qqEircg==",
"license": "Apache-2.0",
"dependencies": {
"es6-promise": "^4.2.5",
"webworkify-webpack": "github:xqq/webworkify-webpack"
}
},
"node_modules/mrmime": { "node_modules/mrmime": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.1.tgz", "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.1.tgz",
@@ -6143,6 +6160,11 @@
"url": "https://opencollective.com/webpack" "url": "https://opencollective.com/webpack"
} }
}, },
"node_modules/webworkify-webpack": {
"version": "2.1.5",
"resolved": "git+ssh://git@github.com/xqq/webworkify-webpack.git#24d1e719b4a6cac37a518b2bb10fe124527ef4ef",
"license": "MIT"
},
"node_modules/which": { "node_modules/which": {
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",

View File

@@ -16,6 +16,7 @@
"hls.js": "^1.5.18", "hls.js": "^1.5.18",
"jssip": "^3.10.1", "jssip": "^3.10.1",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"mpegts.js": "^1.8.0",
"pinia": "^2.2.6", "pinia": "^2.2.6",
"pinia-plugin-persistedstate": "^4.2.0", "pinia-plugin-persistedstate": "^4.2.0",
"pubsub-js": "^1.9.5", "pubsub-js": "^1.9.5",

View File

@@ -528,7 +528,7 @@
if(val==3){ if(val==3){
params.businessVideoDisplayPosition = '' params.businessVideoDisplayPosition = ''
}else{ }else{
params.businessVideoDisplayPosition = navList.value[current.value].dictValue params.businessVideoDisplayPosition = navList.value[current.value]
} }
let res = await getVideoListApi(params) let res = await getVideoListApi(params)
@@ -536,46 +536,10 @@
if (res.data.length > 0) { if (res.data.length > 0) {
videoList.value = res.data videoList.value = res.data
// console.log(videoList.value,'1111111111111111111111')
// postVideoRemain()
nextTick(() => { nextTick(() => {
videoList.value.forEach(async (x, index) => { videoList.value.forEach(async (x, index) => {
const video = document.getElementById(`monitorVideo${index}`) const videoElement = document.getElementById(`monitorVideo${index}`)
const hls = new Hls({ createPlayer(x.cameraIndexCode,videoElement);
maxBufferLength: 10, // 最大缓冲长度(秒)
maxMaxBufferLength: 15, // 缓冲区长度的上限
maxBufferSize: 30 * 1000 * 1000 // 最大缓冲大小(字节)
})
hls.loadSource(x.hlsUrl)
hls.attachMedia(video)
hls.on(Hls.Events.MANIFEST_PARSED, () => {
video.play()
})
hls.on(Hls.Events.ERROR, (event, data) => {
// console.error('HLS 播放器遇到错误:', data);
// hls.startLoad();
// initVideo()
// 根据错误类型进行处理
if (data.fatal) {
switch (data.type) {
case Hls.ErrorTypes.NETWORK_ERROR:
console.log('网络错误,尝试重新加载');
hls.startLoad();
break;
case Hls.ErrorTypes.MEDIA_ERROR:
console.log('媒体错误,尝试修复');
hls.recoverMediaError();
break;
default:
console.log('无法恢复的错误,销毁播放器');
// hls.destroy();
break;
}
}
})
hlsRefs.push(hls)
}) })
}) })
} else { } else {