Compare commits
10 Commits
f09d8c972b
...
046aea0f55
| Author | SHA1 | Date | |
|---|---|---|---|
| 046aea0f55 | |||
| 3e9f7133de | |||
| affc881aaa | |||
| 87c115ab99 | |||
| 6fe84fe853 | |||
| b7499f12d1 | |||
| 724dc4a561 | |||
|
|
cee259db65 | ||
| 3853793886 | |||
| aa75cd9cb9 |
35
package-lock.json
generated
35
package-lock.json
generated
@@ -25,7 +25,7 @@
|
||||
"vue-router": "^4.4.5",
|
||||
"vue3-seamless-scroll": "^2.0.1",
|
||||
"vuedraggable": "^4.1.0",
|
||||
"whepts": "^1.0.2"
|
||||
"whepts": "^1.1.12"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitejs/plugin-vue": "^5.2.1",
|
||||
@@ -3335,6 +3335,12 @@
|
||||
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/eventemitter3": {
|
||||
"version": "5.0.4",
|
||||
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz",
|
||||
"integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/events": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
|
||||
@@ -4324,6 +4330,21 @@
|
||||
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/nanostores": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/nanostores/-/nanostores-1.1.0.tgz",
|
||||
"integrity": "sha512-yJBmDJr18xy47dbNVlHcgdPrulSn1nhSE6Ns9vTG+Nx9VPT6iV1MD6aQFp/t52zpf82FhLLTXAXr30NuCnxvwA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": "^20.0.0 || >=22.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/neo-async": {
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",
|
||||
@@ -6167,10 +6188,14 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/whepts": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/whepts/-/whepts-1.0.2.tgz",
|
||||
"integrity": "sha512-9P0OP514Z2ZR2ev7qMOApplw6ERMChqgPi6eWWn6HTlTpDV0gW7Zqs4kLAKIV7xqxXCDNDCorxNz8ekOYAEp5g==",
|
||||
"license": "MIT"
|
||||
"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",
|
||||
"nanostores": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/which": {
|
||||
"version": "2.0.2",
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
"vue-router": "^4.4.5",
|
||||
"vue3-seamless-scroll": "^2.0.1",
|
||||
"vuedraggable": "^4.1.0",
|
||||
"whepts": "^1.0.2"
|
||||
"whepts": "^1.1.12"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitejs/plugin-vue": "^5.2.1",
|
||||
|
||||
@@ -160,19 +160,26 @@
|
||||
initializePlayer() {
|
||||
if (!this.isActive || !this.url) return
|
||||
|
||||
// 如果是重新初始化播放器,先清理已存在的资源
|
||||
if (this.hls) {
|
||||
this.immediateCleanup()
|
||||
}
|
||||
if(this.url.startsWith('http://192.168.77.200:8050/')){
|
||||
this.hls = new WebRTCWhep({
|
||||
url: this.url, // WHEP 服务器地址
|
||||
container: this.video, // 视频播放容器
|
||||
onError: (error) => {
|
||||
console.error('播放错误:', error)
|
||||
iceServers: [{ urls: 'turn:192.168.77.200:3478',username: 'ZLMediaKit',credential: 'ZLMediaKit'}]
|
||||
})
|
||||
this.hls.on('error', (error) => {
|
||||
console.error('错误:', error.message, error.type)
|
||||
if(error.type ==='REQUEST_ERROR' || error.type ==='NOT_FOUND_ERROR'){
|
||||
this.initializePlayer();
|
||||
}
|
||||
})
|
||||
this.hls.on('play:failed', (err) => {
|
||||
// this.initializePlayer();
|
||||
})
|
||||
}else{
|
||||
// 如果是重新初始化播放器,先清理已存在的资源
|
||||
if (this.hls) {
|
||||
this.immediateCleanup()
|
||||
}
|
||||
this.hls = new Hls({
|
||||
// 内存优化配置
|
||||
maxBufferSize: 0, // 降低缓冲区大小(15MB)
|
||||
|
||||
@@ -81,7 +81,8 @@ import {getVideoListApi, getColletListApi, getPreviewUrlApi} from '@/api/home'
|
||||
console.log(item, 'iscollect')
|
||||
let res = await getPreviewUrlApi({
|
||||
cameraIndexCode: item.cameraIndexCode,
|
||||
type: 'hls'
|
||||
type: 'hls',
|
||||
subStream:0
|
||||
})
|
||||
src.value = res.data.url
|
||||
isCollect.value = item.isCollect
|
||||
@@ -125,17 +126,25 @@ import {getVideoListApi, getColletListApi, getPreviewUrlApi} from '@/api/home'
|
||||
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/')){
|
||||
const player = new WebRTCWhep({
|
||||
url:url, // WHEP 服务器地址
|
||||
container: videoElement, // 视频播放容器
|
||||
onError: (error) => {
|
||||
console.error('播放错误:', error)
|
||||
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{
|
||||
|
||||
@@ -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,17 +97,24 @@ 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/')){
|
||||
const player = new WebRTCWhep({
|
||||
url:url, // WHEP 服务器地址
|
||||
container: videoElement, // 视频播放容器
|
||||
onError: (error) => {
|
||||
console.error('播放错误:', error)
|
||||
iceServers: [{ urls: 'turn:192.168.77.200:3478',username: 'ZLMediaKit',credential: 'ZLMediaKit'}]
|
||||
})
|
||||
player.on('error', (error) => {
|
||||
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{
|
||||
|
||||
@@ -224,7 +224,8 @@
|
||||
show.value = true
|
||||
let res = await getPreviewUrlApi({
|
||||
type: 'hls',
|
||||
cameraIndexCode:itemCode
|
||||
cameraIndexCode:itemCode,
|
||||
subStream:0
|
||||
})
|
||||
cameraIndexCode.value = itemCode;
|
||||
isCollect.value = resource.isCollect
|
||||
@@ -283,17 +284,26 @@
|
||||
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/')){
|
||||
const player = new WebRTCWhep({
|
||||
url: url, // WHEP 服务器地址
|
||||
container: videoElement, // 视频播放容器
|
||||
onError: (error) => {
|
||||
console.error('播放错误:', error)
|
||||
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) => {
|
||||
// console.log('播放失败:', err)
|
||||
// createPlayer(cameraIndexCode,videoElement);
|
||||
})
|
||||
webrtcRefs.push(player)
|
||||
}else{
|
||||
const player = new Hls({
|
||||
|
||||
@@ -418,7 +418,7 @@
|
||||
:deep(.el-dialog__title) {
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
font-size:vw(22);
|
||||
font-size:vw(32);
|
||||
}
|
||||
.bom-box {
|
||||
.table2{
|
||||
@@ -431,7 +431,7 @@
|
||||
.header {
|
||||
height: vh(28);
|
||||
font-weight: 400;
|
||||
font-size:vw(20);
|
||||
font-size:vw(32);
|
||||
color: #fff;
|
||||
display: flex;
|
||||
padding:0;
|
||||
@@ -446,7 +446,7 @@
|
||||
}
|
||||
.list {
|
||||
overflow-y: auto;
|
||||
height: vh(490);
|
||||
height: vh(180);
|
||||
/* 滚动条整体样式 */
|
||||
&::-webkit-scrollbar {
|
||||
width: vw(4); /* 滚动条的宽度 */
|
||||
@@ -463,7 +463,7 @@
|
||||
.item {
|
||||
height: vh(50);
|
||||
font-weight: 400;
|
||||
font-size:vw(18);
|
||||
font-size:vw(28);
|
||||
color: #f1f7ff;
|
||||
display: flex;
|
||||
&:nth-child(2n + 1) {
|
||||
|
||||
@@ -1,25 +1,6 @@
|
||||
<template>
|
||||
<div class="video-box">
|
||||
<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">
|
||||
<Title2 title="检索" />
|
||||
<div class="search-box">
|
||||
@@ -77,13 +58,14 @@
|
||||
>关注
|
||||
</div>
|
||||
<video
|
||||
class="video-item__video"
|
||||
:id="'hotelmonitorVideo' + index"
|
||||
preload="auto"
|
||||
class="video-item__video"
|
||||
muted
|
||||
autoplay
|
||||
:controls="false"
|
||||
>
|
||||
|
||||
<source type="application/x-mpegURL"/>
|
||||
</video>
|
||||
<p class="video-item__title--primary">
|
||||
@@ -304,7 +286,8 @@
|
||||
show.value = true
|
||||
let res = await getPreviewUrlApi({
|
||||
type: 'hls',
|
||||
cameraIndexCode:itemCode
|
||||
cameraIndexCode:itemCode,
|
||||
subStream:0
|
||||
})
|
||||
cameraIndexCode.value = itemCode;
|
||||
isCollect.value = resource.isCollect
|
||||
@@ -340,17 +323,27 @@
|
||||
const createPlayer = (cameraIndexCode,videoElement) => {
|
||||
getPreviewUrlApi({
|
||||
type: 'hls',
|
||||
cameraIndexCode: cameraIndexCode
|
||||
cameraIndexCode: cameraIndexCode,
|
||||
subStream:0
|
||||
}).then(res=>{
|
||||
const url = res.data.url;
|
||||
console.log('url',url)
|
||||
if(url.startsWith('http://192.168.77.200:8050/')){
|
||||
const player = new WebRTCWhep({
|
||||
url:url, // WHEP 服务器地址
|
||||
container: videoElement, // 视频播放容器
|
||||
onError: (error) => {
|
||||
console.error('播放错误:', error)
|
||||
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) => {
|
||||
console.error('错误:',err)
|
||||
// createPlayer(cameraIndexCode,videoElement);
|
||||
})
|
||||
webrtcRefs.push(player)
|
||||
}
|
||||
else{
|
||||
@@ -420,7 +413,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
|
||||
@@ -431,10 +425,18 @@
|
||||
hlsRef = new WebRTCWhep({
|
||||
url: url, // WHEP 服务器地址
|
||||
container: videoRef.value, // 视频播放容器
|
||||
onError: (error) => {
|
||||
console.error('播放错误:', error)
|
||||
iceServers: [{ urls: 'turn:192.168.77.200:3478',username: 'ZLMediaKit',credential: 'ZLMediaKit'}]
|
||||
})
|
||||
hlsRef.on('error', (error) => {
|
||||
console.error('错误:', error.message, error.type)
|
||||
if(error.type ==='REQUEST_ERROR' || error.type ==='NOT_FOUND_ERROR'){
|
||||
handleItemVideo(url, type, code, item);
|
||||
}
|
||||
})
|
||||
hlsRef.on('play:failed', (err) => {
|
||||
console.log('播放失败,尝试重新加载');
|
||||
// handleItemVideo(url, type, code, item);
|
||||
})
|
||||
} else {
|
||||
hlsRef = new Hls({
|
||||
maxBufferLength: 10, // 最大缓冲长度(秒)
|
||||
|
||||
@@ -261,7 +261,8 @@
|
||||
window.addEventListener("message", async(e) => {
|
||||
let {code,data} = await getPreviewUrlApi({
|
||||
type: 'hls',
|
||||
cameraIndexCode:e.data.cameraIndexCode
|
||||
cameraIndexCode:e.data.cameraIndexCode,
|
||||
subStream:0
|
||||
})
|
||||
if(code===200){
|
||||
src.value = data.url
|
||||
|
||||
@@ -366,7 +366,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
|
||||
@@ -377,8 +378,12 @@ const handleItemVideo = async (url, type, code, item) => {
|
||||
hlsRef = new WebRTCWhep({
|
||||
url: url, // WHEP 服务器地址
|
||||
container: videoRef.value, // 视频播放容器
|
||||
onError: (error) => {
|
||||
console.error('播放错误:', error)
|
||||
iceServers: [{ urls: 'turn:192.168.77.200:3478',username: 'ZLMediaKit',credential: 'ZLMediaKit'}]
|
||||
})
|
||||
hlsRef.on('error', (error) => {
|
||||
console.error('错误:', error.message, error.type)
|
||||
if(error.type ==='REQUEST_ERROR' || error.type ==='NOT_FOUND_ERROR'){
|
||||
handleItemVideo(url, type, code, item);
|
||||
}
|
||||
})
|
||||
} else {
|
||||
@@ -429,7 +434,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
|
||||
@@ -492,15 +498,20 @@ watch(
|
||||
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/')){
|
||||
const player = new WebRTCWhep({
|
||||
url: url, // WHEP 服务器地址
|
||||
container: videoElement, // 视频播放容器
|
||||
onError: (error) => {
|
||||
console.error('播放错误:', error)
|
||||
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)
|
||||
}
|
||||
})
|
||||
webrtcRefs.push(player)
|
||||
|
||||
@@ -174,7 +174,8 @@ import pubSub from 'pubsub-js'
|
||||
window.addEventListener("message", async(e) => {
|
||||
let {code,data} = await getPreviewUrlApi({
|
||||
type: 'hls',
|
||||
cameraIndexCode:e.data.cameraIndexCode
|
||||
cameraIndexCode:e.data.cameraIndexCode,
|
||||
subStream:0
|
||||
})
|
||||
if(code===200){
|
||||
src.value = data.url
|
||||
@@ -422,11 +423,11 @@ import pubSub from 'pubsub-js'
|
||||
}
|
||||
.tag--important {
|
||||
@extend .tag;
|
||||
background: #feae00;
|
||||
background:#d9011b;
|
||||
}
|
||||
.tag--warn {
|
||||
@extend .tag;
|
||||
background: #d9011b;
|
||||
background: #feae00;
|
||||
}
|
||||
.tag--normal {
|
||||
@extend .tag;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user