安全管理视频处理

This commit is contained in:
熊丽君
2021-12-28 18:11:34 +08:00
parent a2dcb249f7
commit ec3ec3525a
4 changed files with 94 additions and 30 deletions

View File

@ -36,8 +36,9 @@ import DictTag from '@/components/DictTag'
import VueMeta from 'vue-meta' import VueMeta from 'vue-meta'
// 字典数据组件 // 字典数据组件
import DictData from '@/components/DictData' import DictData from '@/components/DictData'
import Bus from '@/utils/eventBus'
// 全局方法挂载 // 全局方法挂载
Vue.prototype.getDicts = getDicts Vue.prototype.getDicts = getDicts
Vue.prototype.getConfigKey = getConfigKey Vue.prototype.getConfigKey = getConfigKey
Vue.prototype.parseTime = parseTime Vue.prototype.parseTime = parseTime
@ -65,6 +66,7 @@ Vue.component('Editor', Editor)
Vue.component('FileUpload', FileUpload) Vue.component('FileUpload', FileUpload)
Vue.component('ImageUpload', ImageUpload) Vue.component('ImageUpload', ImageUpload)
Vue.use(Bus);
Vue.use(directive) Vue.use(directive)
Vue.use(plugins) Vue.use(plugins)
Vue.use(VueMeta) Vue.use(VueMeta)

18
src/utils/eventBus.js Normal file
View File

@ -0,0 +1,18 @@
// units/bus.js
const install = Vue => {
const Bus = new Vue({
methods: {
on(event, ...args) {
this.$on(event, ...args);
},
emit(event, callback) {
this.$emit(event, callback);
},
off(event, callback) {
this.$off(event, callback);
}
}
});
Vue.prototype.$bus = Bus;
};
export default install;

View File

@ -9,21 +9,21 @@
<img src="./img/left1/icon.png" alt="" /> <img src="./img/left1/icon.png" alt="" />
<span style="margin-left: 2px">一级{{v.pointName}}</span> <span style="margin-left: 2px">一级{{v.pointName}}</span>
</div> </div>
<div class="com_img"><img src="./img/left1/icon1.png" alt="" /></div> <div class="com_img" @click="handleItem(v)"><img src="./img/left1/icon1.png" alt="" /></div>
</div> </div>
<div v-if="v.level == '二级'" class="con_right con_two" :style="{top: v.ordinate +' %',left: v.abscissa + '%'}"> <div v-if="v.level == '二级'" class="con_right con_two" :style="{top: v.ordinate +' %',left: v.abscissa + '%'}">
<div class="con_title con_title_bg2"> <div class="con_title con_title_bg2">
<img src="./img/left1/icon.png" alt="" /> <img src="./img/left1/icon.png" alt="" />
<span style="margin-left: 2px">二级{{v.pointName}}</span> <span style="margin-left: 2px">二级{{v.pointName}}</span>
</div> </div>
<div class="com_img"><img src="./img/left1/icon2.png" alt="" /></div> <div class="com_img" @click="handleItem(v)"><img src="./img/left1/icon2.png" alt="" /></div>
</div> </div>
<div v-if="v.level == '三级'" class="con_right con_three" :style="{top: v.ordinate +' %',left: v.abscissa + '%'}"> <div v-if="v.level == '三级'" class="con_right con_three" :style="{top: v.ordinate +' %',left: v.abscissa + '%'}">
<div class="con_title con_title_bg3"> <div class="con_title con_title_bg3">
<img src="./img/left1/icon.png" alt="" /> <img src="./img/left1/icon.png" alt="" />
<span style="margin-left: 2px">三级{{v.pointName}}</span> <span style="margin-left: 2px">三级{{v.pointName}}</span>
</div> </div>
<div class="com_img"><img src="./img/left1/icon3.png" alt="" /></div> <div class="com_img" @click="handleItem(v)"><img src="./img/left1/icon3.png" alt="" /></div>
</div> </div>
</section> </section>
<!-- <div class="con_right"> <!-- <div class="con_right">
@ -132,8 +132,10 @@ export default {
// this.initChart3() // this.initChart3()
}) })
}, },
beforeDestroy () { },
methods: { methods: {
handleItem(item) {
this.$bus.emit("getTarget", item);
},
getItem (list, name) { getItem (list, name) {
for (let index = 0; index < list.length; index++) { for (let index = 0; index < list.length; index++) {
const item = list[index]; const item = list[index];
@ -164,6 +166,10 @@ export default {
}) })
} }
}, },
beforeDestroy() {
//销毁监听事件
this.$bus.off("getTarget");
}
} }
</script> </script>

View File

@ -7,14 +7,14 @@
<!-- <div id="left1" ref="left1" class="chart1"></div> --> <!-- <div id="left1" ref="left1" class="chart1"></div> -->
<div style="height: 270px; margin: 14px 0 8px"> <div style="height: 270px; margin: 14px 0 8px">
<!-- <img style="width: 100%; height: 100%" src="./img/left1/1.jpg" alt="" /> --> <!-- <img style="width: 100%; height: 100%" src="./img/left1/1.jpg" alt="" /> -->
<video style="width: 100%; height: 100%" id="videoElement" muted controls autoplay> <video style="width: 100%; height: 100%" :src="videoUrl" id="videoElement" muted controls autoplay>
Your browser is too old which doesn't support HTML5 video. Your browser is too old which doesn't support HTML5 video.
</video> </video>
</div> </div>
<div style="text-align: right; margin-bottom: 14px; font-size: 14px"> <div style="text-align: right; margin-bottom: 14px; font-size: 14px">
<span style="opacity: 0.9">视频监控 / </span> <span :style="{opacity:videoIndex==0? 0.9:0.7,cursor:'pointer'}" @click="handleVideoType(0)">视频监控 / </span>
<span style="opacity: 0.7">奖惩播放 / </span> <span :style="{opacity:videoIndex==1? 0.9:0.7,cursor:'pointer'}" @click="handleVideoType(1)">奖惩播放 / </span>
<span style="opacity: 0.7">典型案例播放</span> <span :style="{opacity:videoIndex==2? 0.9:0.7,cursor:'pointer'}" @click="handleVideoType(2)">典型案例播放</span>
</div> </div>
<div style="display: flex; align-items: center; margin-bottom: 28px"> <div style="display: flex; align-items: center; margin-bottom: 28px">
<span>危险点视频覆盖率</span> <span>危险点视频覆盖率</span>
@ -93,14 +93,12 @@ export default {
listData: [1, 2, 3, 4,5,6,7,8], listData: [1, 2, 3, 4,5,6,7,8],
rate: 0, rate: 0,
points: [], points: [],
videoIndex: 0,
flvPlayer: null, flvPlayer: null,
videoUrl: ''
} }
}, },
mounted () { mounted () {
let videoElement = document.getElementById('videoElement')
this.flvPlayer.attachMediaElement(videoElement)
this.flvPlayer.load()
this.flvPlayer.play()
this.$nextTick(() => { this.$nextTick(() => {
this.getData() this.getData()
// this.initChart() // this.initChart()
@ -115,6 +113,53 @@ export default {
this.flvPlayer.player = null this.flvPlayer.player = null
}, },
methods: { methods: {
handleVideoType(val){
this.videoIndex = val
if(val==0){
this.videoUrl=''
}else if(val==1){
this.request({
url: '/hx/securityManagement/getVideoByType',
params:{
type:'1'
}
}).then(res=>{
this.videoUrl = res.msg
})
}else{
this.request({
url: '/hx/securityManagement/getVideoByType',
params:{
type:'2'
}
}).then(res=>{
this.videoUrl = res.msg
})
}
},
setVideoUrl(videoUrl){
if (flvjs.isSupported()) {
this.flvPlayer = flvjs.createPlayer(
{
type: 'flv', // 媒体类型 flv 或 mp4
isLive: true, // 是否为直播流
fluid: true,
// hasAudio: true, // 是否开启声音
stashInitialSize: 128, // 减少首桢显示等待时长
url: videoUrl,
},
{
enableStashBuffer: false,
fixAudioTimestampGap: false,
isLive: true,
}
)
}
let videoElement = document.getElementById('videoElement')
this.flvPlayer.attachMediaElement(videoElement)
this.flvPlayer.load()
this.flvPlayer.play()
},
getData () { getData () {
this.request({ this.request({
url: '/hx/securityManagement/dangerousMap', url: '/hx/securityManagement/dangerousMap',
@ -125,6 +170,10 @@ export default {
this.rate = res.data.rate; this.rate = res.data.rate;
this.listData = Array(this.points.length*2).fill(0); this.listData = Array(this.points.length*2).fill(0);
this.$refs.seamlessScroll.reset(); this.$refs.seamlessScroll.reset();
if(this.points.length){
// this.setVideoUrl(this.rate[0].rtmpAddress)
this.setVideoUrl('http://192.168.0.151:81/stream/live/classic_cases_video.flv')
}
} }
}) })
}, },
@ -301,23 +350,12 @@ export default {
}, },
}, },
created () { created () {
if (flvjs.isSupported()) { this.$bus.on("getTarget", res => {
this.flvPlayer = flvjs.createPlayer( console.log(this.videoIndex);
{ this.videoIndex = 0
type: 'flv', // 媒体类型 flv 或 mp4 this.setVideoUrl(res.rtmpAddress)
isLive: true, // 是否为直播流 console.log(this.videoIndex);
fluid: true, });
// hasAudio: true, // 是否开启声音
stashInitialSize: 128, // 减少首桢显示等待时长
url: 'http://192.168.0.151:81/stream/live/livestream.flv',
},
{
enableStashBuffer: false,
fixAudioTimestampGap: false,
isLive: true,
}
)
}
}, },
} }
</script> </script>