Files

108 lines
2.4 KiB
Vue
Raw Normal View History

2021-12-10 19:19:57 +08:00
<template>
<div>
<container2 title="视频检验系统实况">
<div class="box">
<div class="_img">
2021-12-21 14:31:02 +08:00
<!-- <img src="./1.jpg" alt="" /> -->
2021-12-21 16:07:51 +08:00
<!-- muted controls autoplay -->
2021-12-21 16:25:13 +08:00
<video id="videoElement" muted autoplay>Your browser is too old which doesn't support HTML5 video.</video>
2021-12-10 19:19:57 +08:00
</div>
<div class="text">
<p style="opacity: 0.8">实况信息</p>
2021-12-22 13:54:05 +08:00
<p style="opacity: 0.5; color: #91d5fe; font-size: 14px">{{ videoInfo.videoNowInfo }}</p>
2021-12-10 19:19:57 +08:00
</div>
</div>
</container2>
</div>
</template>
<script>
2021-12-21 14:31:02 +08:00
import flvjs from 'flv.js'
2021-12-10 19:19:57 +08:00
import scalseBox from '../components/scaleBox.vue'
import bigScreenHead from '../components/bigScreenHead/index.vue'
import rocketTit from '../components/rocketTit/index.vue'
import container2 from './components/container2/index.vue'
import echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
import resize from '../../dashboard/mixins/resize'
export default {
mixins: [resize],
name: 'left3',
components: {
scalseBox,
bigScreenHead,
rocketTit,
container2,
},
data() {
2021-12-21 14:31:02 +08:00
return {
2021-12-22 13:54:05 +08:00
videoInfo: {},
2021-12-21 14:31:02 +08:00
flvPlayer: null,
}
2021-12-10 19:19:57 +08:00
},
2021-12-21 14:31:02 +08:00
beforeDestroy() {
this.flvPlayer.player.pause()
this.flvPlayer.player.unload()
this.flvPlayer.player.detachMediaElement()
this.flvPlayer.player.destroy()
this.flvPlayer.player = null
},
2021-12-21 16:07:51 +08:00
methods: {},
created() {
2021-12-22 13:54:05 +08:00
this.request({
url: '/hx/qualityAssurance/getHxVideoSystem',
method: 'get',
}).then(({ data }) => {
this.videoInfo = data[0]
if (flvjs.isSupported()) {
this.flvPlayer = flvjs.createPlayer(
{
type: 'flv', // 媒体类型 flv 或 mp4
isLive: true, // 是否为直播流
fluid: true,
// hasAudio: true, // 是否开启声音
stashInitialSize: 128, // 减少首桢显示等待时长
url: this.videoInfo.videoAddress,
},
{
enableStashBuffer: false,
fixAudioTimestampGap: false,
isLive: true,
}
)
let videoElement = document.getElementById('videoElement')
this.flvPlayer.attachMediaElement(videoElement)
this.flvPlayer.load()
this.flvPlayer.play()
}
})
2021-12-21 16:07:51 +08:00
},
2021-12-10 19:19:57 +08:00
}
</script>
<style lang="scss" scoped>
.box {
display: flex;
padding: 0 10px 0 0;
._img {
width: 310px;
height: 229px;
2021-12-21 16:07:51 +08:00
img {
width: 100%;
height: 100%;
}
2021-12-21 14:31:02 +08:00
video {
2021-12-10 19:19:57 +08:00
width: 100%;
height: 100%;
}
}
.text {
flex: 1;
2021-12-21 16:07:51 +08:00
padding: 15px;
// background-color: rgba(145, 213, 254, 0.15);
2021-12-10 19:19:57 +08:00
}
}
</style>