|
|
@ -4,7 +4,7 @@
|
|
|
|
* @Author: JC9527
|
|
|
|
* @Author: JC9527
|
|
|
|
* @Date: 2024-01-09 23:08:15
|
|
|
|
* @Date: 2024-01-09 23:08:15
|
|
|
|
* @LastEditors: JC9527
|
|
|
|
* @LastEditors: JC9527
|
|
|
|
* @LastEditTime: 2024-08-15 11:05:25
|
|
|
|
* @LastEditTime: 2024-08-15 16:35:22
|
|
|
|
-->
|
|
|
|
-->
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
<div class="map-main">
|
|
|
|
<div class="map-main">
|
|
|
@ -622,6 +622,7 @@ export default {
|
|
|
|
onIcon:null,
|
|
|
|
onIcon:null,
|
|
|
|
offIcon:null,
|
|
|
|
offIcon:null,
|
|
|
|
videoPoint:[],
|
|
|
|
videoPoint:[],
|
|
|
|
|
|
|
|
videoUrl:"",
|
|
|
|
};
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
@ -1366,24 +1367,28 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 播放监控视频
|
|
|
|
// 播放监控视频
|
|
|
|
initVideoPlayer(videoUrl){
|
|
|
|
initVideoPlayer(){
|
|
|
|
this.$nextTick(()=>{
|
|
|
|
this.$nextTick(()=>{
|
|
|
|
var videoDom = document.getElementById('flvvideo')
|
|
|
|
var videoDom = document.getElementById('flvvideo')
|
|
|
|
|
|
|
|
|
|
|
|
var player = flvjs.createPlayer({
|
|
|
|
this.player = flvjs.createPlayer({
|
|
|
|
type: 'flv', // 媒体类型,默认是 flv,
|
|
|
|
type: 'flv', // 媒体类型,默认是 flv,
|
|
|
|
isLive: true, // 是否是直播流
|
|
|
|
isLive: true, // 是否是直播流
|
|
|
|
hasAudio: true, // 是否有音频
|
|
|
|
hasAudio: true, // 是否有音频
|
|
|
|
hanVideo: true, // 是否有视频
|
|
|
|
hanVideo: true, // 是否有视频
|
|
|
|
url: videoUrl, // 流地址
|
|
|
|
url: this.videoUrl, // 流地址
|
|
|
|
},{
|
|
|
|
},{
|
|
|
|
// 其他的配置项可以根据项目实际情况参考 api 去配置
|
|
|
|
// 其他的配置项可以根据项目实际情况参考 api 去配置
|
|
|
|
autoCleanupMinBackwardDuration: true, // 清除缓存 对 SourceBuffer 进行自动清理
|
|
|
|
autoCleanupMinBackwardDuration: true, // 清除缓存 对 SourceBuffer 进行自动清理
|
|
|
|
})
|
|
|
|
})
|
|
|
|
player.attachMediaElement(videoDom)
|
|
|
|
this.player.attachMediaElement(videoDom)
|
|
|
|
player.load()
|
|
|
|
try {
|
|
|
|
player.play()
|
|
|
|
this.player.load();
|
|
|
|
this.player = player;
|
|
|
|
this.player.play();
|
|
|
|
|
|
|
|
this.listenVideo();
|
|
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
|
|
}
|
|
|
|
// 视频卡顿导致流断了,那就重连
|
|
|
|
// 视频卡顿导致流断了,那就重连
|
|
|
|
// this.player.on(flvjs.Events.ERROR,(errType, errDetail)=>{
|
|
|
|
// this.player.on(flvjs.Events.ERROR,(errType, errDetail)=>{
|
|
|
|
// // console.log(errType,'errTypeerrTypeerrType');
|
|
|
|
// // console.log(errType,'errTypeerrTypeerrType');
|
|
|
@ -1393,7 +1398,6 @@ export default {
|
|
|
|
// this.initVideoPlayer(videoUrl)
|
|
|
|
// this.initVideoPlayer(videoUrl)
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// })
|
|
|
|
// })
|
|
|
|
this.instantaneity(this.player,videoUrl)
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
destroyVideos() {
|
|
|
|
destroyVideos() {
|
|
|
@ -1404,29 +1408,61 @@ export default {
|
|
|
|
this.player.destroy();
|
|
|
|
this.player.destroy();
|
|
|
|
this.player = null;
|
|
|
|
this.player = null;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 可能会有卡顿的情况 重新去拉流由于视频会延时 为保证实时性,我们可以跳帧
|
|
|
|
// 监听视频流是否断流或者卡顿
|
|
|
|
instantaneity(player,videoUrl){
|
|
|
|
listenVideo() {
|
|
|
|
this.timer = setInterval(() => {
|
|
|
|
const that = this;
|
|
|
|
if (player && player.buffered && player.buffered.length) {
|
|
|
|
if(this.player) {
|
|
|
|
let end = player.buffered.end(0); // 获取当前buffered值
|
|
|
|
this.player.on(
|
|
|
|
let diff = end - player.currentTime; // 获取buffered与currentTime的差值
|
|
|
|
flvjs.Events.ERROR,
|
|
|
|
if (diff >= 3) {// 如果差值大于等于3s 手动跳帧 这里可根据自身需求来定
|
|
|
|
(errorType, errorDetail, errorInfo) => {
|
|
|
|
//单个视频
|
|
|
|
// console.log("errorType", errorType);
|
|
|
|
player.currentTime = end;//手动跳帧
|
|
|
|
// console.log("errorDetail", errorDetail);
|
|
|
|
player.currentTime = player.buffered.end(0);//手动跳帧
|
|
|
|
// console.log("errorInfo", errorInfo);
|
|
|
|
|
|
|
|
if(errorInfo.code == 404) {
|
|
|
|
// 多个视频
|
|
|
|
setTimeout(()=>{
|
|
|
|
clearInterval(this.timer)
|
|
|
|
videoSurveillance({
|
|
|
|
// player.pause();
|
|
|
|
...that.videoCondition,
|
|
|
|
// player.unload();
|
|
|
|
destID:that.personInfo.info.userId,
|
|
|
|
// player.detachMediaElement();
|
|
|
|
imei:that.personInfo.info.imei
|
|
|
|
// player.destroy();
|
|
|
|
}).then((res) => {
|
|
|
|
// player= null;
|
|
|
|
if (res.code == 200 && res.data.msg == "操作成功") {
|
|
|
|
//重新加载当前停止的视频流,根据个人的方法来配置
|
|
|
|
setTimeout(()=>{
|
|
|
|
this.initVideoPlayer(videoUrl)
|
|
|
|
that.videoUrl = `http://10.236.2.28:54567/bjh-admin-server/jn/live/9999_${that.personInfo.info.userId}.flv`
|
|
|
|
}
|
|
|
|
if(!that.showVideo) {
|
|
|
|
}
|
|
|
|
videoSurveillance({destId:that.personInfo.info.userId,imei:that.personInfo.info.imei,msgType:0}).then(res=>{
|
|
|
|
}, 2000); //2000毫秒执行一次
|
|
|
|
that.personInfo.info.userId = "";
|
|
|
|
|
|
|
|
that.personInfo.info.imei = "";
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
that.destroyVideos();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
that.initVideoPlayer();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},3000);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},2000)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// 视频出错后销毁重建
|
|
|
|
|
|
|
|
that.destroyVideos();
|
|
|
|
|
|
|
|
that.initVideoPlayer();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
// 视频断流
|
|
|
|
|
|
|
|
this.player.on("statistics_info", function (res) {
|
|
|
|
|
|
|
|
if(that.lastDecodedFrames === 0){
|
|
|
|
|
|
|
|
that.lastDecodedFrames = res.decodedFrames
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(that.lastDecodedFrames != res.decodedFrames){
|
|
|
|
|
|
|
|
that.lastDecodedFrames = res.decodedFrames
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
that.lastDecodedFrames = 0
|
|
|
|
|
|
|
|
that.destroyVideos()
|
|
|
|
|
|
|
|
that.initVideoPlayer()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 执法人员强制观摩
|
|
|
|
// 执法人员强制观摩
|
|
|
|
watchClick(){
|
|
|
|
watchClick(){
|
|
|
@ -1436,7 +1472,8 @@ export default {
|
|
|
|
if(res.code == 200 && res.data.msg == '操作成功') {
|
|
|
|
if(res.code == 200 && res.data.msg == '操作成功') {
|
|
|
|
// http://121.229.2.163:9291/live/9999 http://120.27.25.166:9305/live/9999_
|
|
|
|
// http://121.229.2.163:9291/live/9999 http://120.27.25.166:9305/live/9999_
|
|
|
|
setTimeout(()=>{
|
|
|
|
setTimeout(()=>{
|
|
|
|
this.initVideoPlayer(`http://10.236.2.28:54567/bjh-admin-server/jn/live/9999_${this.personInfo.info.userId}.flv`)
|
|
|
|
this.videoUrl = `http://10.236.2.28:54567/bjh-admin-server/jn/live/9999_${this.personInfo.info.userId}.flv`
|
|
|
|
|
|
|
|
this.initVideoPlayer()
|
|
|
|
},3000)
|
|
|
|
},3000)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|