mirror of
https://gitee.com/pan648540858/wvp-GB28181-pro.git
synced 2026-05-24 22:17:49 +08:00
修复云端录像播放页面
This commit is contained in:
parent
9edbcd9768
commit
15ff87a323
@ -1,6 +1,6 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: "iconfont"; /* Project id 1291092 */
|
font-family: "iconfont"; /* Project id 1291092 */
|
||||||
src: url('iconfont.woff2?t=1743052226670') format('woff2');
|
src: url('iconfont.woff2?t=1758456390170') format('woff2');
|
||||||
}
|
}
|
||||||
|
|
||||||
.iconfont {
|
.iconfont {
|
||||||
|
|||||||
Binary file not shown.
361
web/src/views/cloudRecord/cloudRecordPlayer.vue
Executable file
361
web/src/views/cloudRecord/cloudRecordPlayer.vue
Executable file
@ -0,0 +1,361 @@
|
|||||||
|
<template>
|
||||||
|
<div id="cloudRecordPlayer" >
|
||||||
|
<div class="cloud-record-playBox" :style="playBoxStyle">
|
||||||
|
<h265web ref="recordVideoPlayer" :video-url="videoUrl" :height="'calc(100vh - 250px)'" :show-button="false" @playTimeChange="showPlayTimeChange" @playStatusChange="playingChange"/>
|
||||||
|
</div>
|
||||||
|
<div class="cloud-record-player-option-box">
|
||||||
|
<div class="cloud-record-show-time">
|
||||||
|
{{showPlayTimeValue}}
|
||||||
|
</div>
|
||||||
|
<div class="cloud-record-time-process" ref="timeProcess" @click="timeProcessClick($event)"
|
||||||
|
@mouseenter="timeProcessMouseEnter($event)" @mousemove="timeProcessMouseMove($event)"
|
||||||
|
@mouseleave="timeProcessMouseLeave($event)">
|
||||||
|
<div v-if="streamInfo">
|
||||||
|
<div class="cloud-record-time-process-value" :style="playTimeValue"></div>
|
||||||
|
<transition name="el-fade-in-linear">
|
||||||
|
<div v-show="showTimeLeft" class="cloud-record-time-process-title" :style="playTimeTitleStyle" >{{showPlayTimeTitle}}</div>
|
||||||
|
</transition>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="cloud-record-show-time">
|
||||||
|
{{showPlayTimeTotal}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="height: 40px; background-color: #383838; display: grid; grid-template-columns: 1fr 600px 1fr">
|
||||||
|
<div style="text-align: left;">
|
||||||
|
<div class="cloud-record-record-play-control" style="background-color: transparent; box-shadow: 0 0 10px transparent">
|
||||||
|
<a v-if="showListCallback" target="_blank" class="cloud-record-record-play-control-item iconfont icon-list" title="列表" @click="sidebarControl()" />
|
||||||
|
<a target="_blank" class="cloud-record-record-play-control-item iconfont icon-camera1196054easyiconnet" title="截图" @click="snap()" />
|
||||||
|
<!-- <a target="_blank" class="cloud-record-record-play-control-item iconfont icon-xiazai011" title="下载" />-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="text-align: center;">
|
||||||
|
<div class="cloud-record-record-play-control">
|
||||||
|
<a v-if="!lastDiable" target="_blank" class="cloud-record-record-play-control-item iconfont icon-diyigeshipin" title="上一个" @click="playLast()" />
|
||||||
|
<a v-else style="color: #acacac; cursor: not-allowed" target="_blank" class="cloud-record-record-play-control-item iconfont icon-diyigeshipin" title="上一个" />
|
||||||
|
<a target="_blank" class="cloud-record-record-play-control-item iconfont icon-kuaijin" title="快退五秒" @click="seekBackward()" />
|
||||||
|
<a target="_blank" class="cloud-record-record-play-control-item iconfont icon-stop1" style="font-size: 14px" title="停止" @click="stopPLay()" />
|
||||||
|
<a v-if="playing" target="_blank" class="cloud-record-record-play-control-item iconfont icon-zanting" title="暂停" @click="pausePlay()" />
|
||||||
|
<a v-if="!playing" target="_blank" class="cloud-record-record-play-control-item iconfont icon-kaishi" title="播放" @click="play()" />
|
||||||
|
<a target="_blank" class="cloud-record-record-play-control-item iconfont icon-houtui" title="快进五秒" @click="seekForward()" />
|
||||||
|
<a v-if="!nextDiable" target="_blank" class="cloud-record-record-play-control-item iconfont icon-zuihouyigeshipin" title="下一个" @click="playNext()" />
|
||||||
|
<a v-else style="color: #acacac; cursor: not-allowed" target="_blank" class="cloud-record-record-play-control-item iconfont icon-zuihouyigeshipin" title="下一个" @click="playNext()" />
|
||||||
|
<el-dropdown @command="changePlaySpeed">
|
||||||
|
<a target="_blank" class="cloud-record-record-play-control-item record-play-control-speed" title="倍速播放">{{ playSpeed }}X</a>
|
||||||
|
<el-dropdown-menu slot="dropdown">
|
||||||
|
<el-dropdown-item
|
||||||
|
v-for="item in playSpeedRange"
|
||||||
|
:key="item"
|
||||||
|
:command="item"
|
||||||
|
>{{ item }}X</el-dropdown-item>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</el-dropdown>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="text-align: right;">
|
||||||
|
<div class="cloud-record-record-play-control" style="background-color: transparent; box-shadow: 0 0 10px transparent">
|
||||||
|
<a v-if="!isFullScreen" target="_blank" class="cloud-record-record-play-control-item iconfont icon-fangdazhanshi" title="全屏" @click="fullScreen()" />
|
||||||
|
<a v-else target="_blank" class="cloud-record-record-play-control-item iconfont icon-suoxiao1" title="全屏" @click="fullScreen()" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import h265web from '../common/h265web.vue'
|
||||||
|
import moment from 'moment'
|
||||||
|
import momentDurationFormatSetup from 'moment-duration-format'
|
||||||
|
import screenfull from 'screenfull'
|
||||||
|
|
||||||
|
momentDurationFormatSetup(moment)
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'CloudRecordPlayer',
|
||||||
|
components: {
|
||||||
|
h265web
|
||||||
|
},
|
||||||
|
props: ['showListCallback', 'showNextCallback', 'showLastCallback', 'lastDiable', 'nextDiable'],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
showSidebar: false,
|
||||||
|
videoUrl: null,
|
||||||
|
streamInfo: null,
|
||||||
|
showTimeLeft: null,
|
||||||
|
isMousedown: false,
|
||||||
|
loading: false,
|
||||||
|
playerTime: null,
|
||||||
|
playSpeed: 1,
|
||||||
|
playLoading: false,
|
||||||
|
isFullScreen: false,
|
||||||
|
playing: false,
|
||||||
|
initTime: null,
|
||||||
|
playSpeedRange: [1, 2, 4, 6, 8, 16, 20]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
playBoxStyle() {
|
||||||
|
return {
|
||||||
|
height: this.isFullScreen ? 'calc(100vh - 61px)' : 'calc(100vh - 190px)'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
showPlayTimeValue() {
|
||||||
|
return this.streamInfo === null ? '--:--:--' : moment.duration(this.playerTime, 'milliseconds').format('hh:mm:ss', {
|
||||||
|
trim: false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
playTimeValue() {
|
||||||
|
return { width: this.playerTime/this.streamInfo.duration * 100 + '%' }
|
||||||
|
},
|
||||||
|
showPlayTimeTotal() {
|
||||||
|
if (this.streamInfo === null) {
|
||||||
|
return '--:--:--'
|
||||||
|
}else {
|
||||||
|
return moment.duration(this.streamInfo.duration, 'milliseconds').format('hh:mm:ss', {
|
||||||
|
trim: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
playTimeTotal() {
|
||||||
|
return { left: `calc(${this.playerTime/this.streamInfo.duration * 100}% - 6px)` }
|
||||||
|
},
|
||||||
|
playTimeTitleStyle() {
|
||||||
|
return { left: (this.showTimeLeft - 16) + 'px' }
|
||||||
|
},
|
||||||
|
showPlayTimeTitle() {
|
||||||
|
if (this.showTimeLeft) {
|
||||||
|
let time = this.showTimeLeft / this.$refs.timeProcess.clientWidth * this.streamInfo.duration
|
||||||
|
let chooseFile = this.detailFiles[this.chooseFileIndex]
|
||||||
|
let realTime = chooseFile.timeLen/this.streamInfo.duration * time + chooseFile.startTime
|
||||||
|
return `${moment(time).format('mm:ss')}(${moment(realTime).format('HH:mm:ss')})`
|
||||||
|
}else {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
document.addEventListener('mousemove', this.timeProcessMousemove)
|
||||||
|
document.addEventListener('mouseup', this.timeProcessMouseup)
|
||||||
|
},
|
||||||
|
mounted() {},
|
||||||
|
destroyed() {
|
||||||
|
this.$destroy('recordVideoPlayer')
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
timeProcessMouseup(event) {
|
||||||
|
this.isMousedown = false
|
||||||
|
},
|
||||||
|
timeProcessMousemove(event) {
|
||||||
|
|
||||||
|
},
|
||||||
|
timeProcessClick(event) {
|
||||||
|
let x = event.offsetX
|
||||||
|
let clientWidth = this.$refs.timeProcess.clientWidth
|
||||||
|
this.seekRecord(x / clientWidth * this.streamInfo.duration)
|
||||||
|
},
|
||||||
|
timeProcessMousedown(event) {
|
||||||
|
this.isMousedown = true
|
||||||
|
},
|
||||||
|
timeProcessMouseEnter(event) {
|
||||||
|
this.showTimeLeft = event.offsetX
|
||||||
|
},
|
||||||
|
timeProcessMouseMove(event) {
|
||||||
|
this.showTimeLeft = event.offsetX
|
||||||
|
},
|
||||||
|
timeProcessMouseLeave(event) {
|
||||||
|
this.showTimeLeft = null
|
||||||
|
},
|
||||||
|
sidebarControl() {
|
||||||
|
this.showSidebar = !this.showSidebar
|
||||||
|
this.showListCallback(this.showSidebar)
|
||||||
|
},
|
||||||
|
snap() {
|
||||||
|
this.$refs.recordVideoPlayer.screenshot()
|
||||||
|
},
|
||||||
|
playLast() {
|
||||||
|
this.showLastCallback()
|
||||||
|
},
|
||||||
|
playNext() {
|
||||||
|
this.showNextCallback()
|
||||||
|
},
|
||||||
|
changePlaySpeed(speed) {
|
||||||
|
// 倍速播放
|
||||||
|
this.playSpeed = speed
|
||||||
|
this.$store.dispatch('cloudRecord/speed', {
|
||||||
|
mediaServerId: this.streamInfo.mediaServerId,
|
||||||
|
app: this.streamInfo.app,
|
||||||
|
stream: this.streamInfo.stream,
|
||||||
|
key: this.streamInfo.key,
|
||||||
|
speed: this.playSpeed,
|
||||||
|
schema: 'ts'
|
||||||
|
})
|
||||||
|
this.$refs.recordVideoPlayer.setPlaybackRate(this.playSpeed)
|
||||||
|
},
|
||||||
|
seekBackward() {
|
||||||
|
// 快退五秒
|
||||||
|
this.seekRecord(this.playerTime - 5 * 1000)
|
||||||
|
},
|
||||||
|
seekForward() {
|
||||||
|
// 快进五秒
|
||||||
|
this.seekRecord(this.playerTime + 5 * 1000)
|
||||||
|
},
|
||||||
|
stopPLay() {
|
||||||
|
// 停止
|
||||||
|
if (this.$refs.recordVideoPlayer.playing) {
|
||||||
|
this.$refs.recordVideoPlayer.destroy()
|
||||||
|
}
|
||||||
|
this.streamInfo = null
|
||||||
|
this.playerTime = null
|
||||||
|
this.playSpeed = 1
|
||||||
|
},
|
||||||
|
pausePlay() {
|
||||||
|
// 暂停
|
||||||
|
this.$refs.recordVideoPlayer.pause()
|
||||||
|
// TODO
|
||||||
|
},
|
||||||
|
play() {
|
||||||
|
if (this.$refs.recordVideoPlayer.loaded) {
|
||||||
|
this.$refs.recordVideoPlayer.unPause()
|
||||||
|
} else {
|
||||||
|
this.playRecord()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fullScreen() {
|
||||||
|
// 全屏
|
||||||
|
if (this.isFullScreen) {
|
||||||
|
screenfull.exit()
|
||||||
|
this.isFullScreen = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const playerWidth = this.$refs.recordVideoPlayer.playerWidth
|
||||||
|
const playerHeight = this.$refs.recordVideoPlayer.playerHeight
|
||||||
|
screenfull.request(document.getElementById('playerBox'))
|
||||||
|
screenfull.on('change', (event) => {
|
||||||
|
this.$refs.recordVideoPlayer.resize(playerWidth, playerHeight)
|
||||||
|
this.isFullScreen = screenfull.isFullscreen
|
||||||
|
})
|
||||||
|
this.isFullScreen = true
|
||||||
|
},
|
||||||
|
setStreamInfo(streamInfo) {
|
||||||
|
if (location.protocol === 'https:') {
|
||||||
|
this.videoUrl = streamInfo['wss_flv']
|
||||||
|
} else {
|
||||||
|
this.videoUrl = streamInfo['ws_flv']
|
||||||
|
}
|
||||||
|
this.streamInfo = streamInfo
|
||||||
|
},
|
||||||
|
seekRecord(playSeekValue) {
|
||||||
|
this.$store.dispatch('cloudRecord/seek', {
|
||||||
|
mediaServerId: this.streamInfo.mediaServerId,
|
||||||
|
app: this.streamInfo.app,
|
||||||
|
stream: this.streamInfo.stream,
|
||||||
|
seek: playSeekValue,
|
||||||
|
schema: 'fmp4'
|
||||||
|
})
|
||||||
|
.then((data) => {
|
||||||
|
this.playerTime = playSeekValue
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.log(error)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
showPlayTimeChange(val) {
|
||||||
|
this.playerTime += val * 1000
|
||||||
|
},
|
||||||
|
playingChange(val) {
|
||||||
|
this.playing = val
|
||||||
|
if (!val) {
|
||||||
|
this.stopPLay()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.cloud-record-playBox {
|
||||||
|
width: 100%;
|
||||||
|
background-color: #000000;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.cloud-record-record-play-control {
|
||||||
|
height: 32px;
|
||||||
|
line-height: 32px;
|
||||||
|
display: inline-block;
|
||||||
|
width: fit-content;
|
||||||
|
padding: 0 10px;
|
||||||
|
-webkit-box-shadow: 0 0 10px #262626;
|
||||||
|
box-shadow: 0 0 10px #262626;
|
||||||
|
background-color: #262626;
|
||||||
|
margin: 4px 0;
|
||||||
|
}
|
||||||
|
.cloud-record-record-play-control-item {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 0 10px;
|
||||||
|
color: #fff;
|
||||||
|
margin-right: 2px;
|
||||||
|
}
|
||||||
|
.cloud-record-record-play-control-item:hover {
|
||||||
|
color: #1f83e6;
|
||||||
|
}
|
||||||
|
.cloud-record-record-play-control-speed {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #fff;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
.cloud-record-player-option-box {
|
||||||
|
height: 20px;
|
||||||
|
width: 100%;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 70px auto 70px;
|
||||||
|
background-color: rgb(0, 0, 0);
|
||||||
|
}
|
||||||
|
.cloud-record-time-process {
|
||||||
|
width: 100%;
|
||||||
|
height: 8px;
|
||||||
|
margin: 6px 0 ;
|
||||||
|
border-radius: 4px;
|
||||||
|
border: 1px solid #505050;
|
||||||
|
background-color: rgb(56, 56, 56);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.cloud-record-show-time {
|
||||||
|
color: #FFFFFF;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 20px
|
||||||
|
}
|
||||||
|
.cloud-record-time-process-value {
|
||||||
|
width: 100%;
|
||||||
|
height: 6px;
|
||||||
|
background-color: rgb(162, 162, 162);
|
||||||
|
}
|
||||||
|
.cloud-record-time-process-value::after {
|
||||||
|
content: '';
|
||||||
|
display: block;
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
background-color: rgb(192 190 190);
|
||||||
|
border-radius: 5px;
|
||||||
|
position: relative;
|
||||||
|
top: -3px;
|
||||||
|
right: -6px;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
.cloud-record-time-process-title {
|
||||||
|
width: fit-content;
|
||||||
|
text-align: center;
|
||||||
|
position: relative;
|
||||||
|
top: -35px;
|
||||||
|
color: rgb(217, 217, 217);
|
||||||
|
font-size: 14px;
|
||||||
|
text-shadow:
|
||||||
|
-1px -1px 0 black, /* 左上角阴影 */
|
||||||
|
1px -1px 0 black, /* 右上角阴影 */
|
||||||
|
-1px 1px 0 black, /* 左下角阴影 */
|
||||||
|
1px 1px 0 black; /* 右下角阴影 */
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -46,69 +46,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="playerBox">
|
<div id="playerBox">
|
||||||
<div class="playBox" style="height: calc(100vh - 190px); width: 100%; background-color: #000000">
|
<cloudRecordPlayer ref="cloudRecordPlayer" :showListCallback="sidebarControl" :showNextCallback="playNext"
|
||||||
<div v-if="playLoading" style="position: relative; left: calc(50% - 32px); top: 43%; z-index: 100;color: #fff;float: left; text-align: center;">
|
:showLastCallback="playLast" :lastDiable="lastBtnDiable" :nextDiable="nextBtnDiable" ></cloudRecordPlayer>
|
||||||
<div class="el-icon-loading" />
|
|
||||||
<div style="width: 100%; line-height: 2rem">正在加载</div>
|
|
||||||
</div>
|
|
||||||
<h265web ref="recordVideoPlayer" :video-url="videoUrl" :height="'calc(100vh - 250px)'" :show-button="false" @playTimeChange="showPlayTimeChange" @playStatusChange="playingChange"/>
|
|
||||||
</div>
|
|
||||||
<div class="player-option-box">
|
|
||||||
<div class="cloud-record-show-time">
|
|
||||||
{{showPlayTimeValue}}
|
|
||||||
</div>
|
|
||||||
<div class="cloud-record-time-process" ref="timeProcess" @click="timeProcessClick($event)"
|
|
||||||
@mouseenter="timeProcessMouseEnter($event)" @mousemove="timeProcessMouseMove($event)"
|
|
||||||
@mouseleave="timeProcessMouseLeave($event)">
|
|
||||||
<div v-if="streamInfo">
|
|
||||||
<div class="cloud-record-time-process-value" :style="playTimeValue"></div>
|
|
||||||
<transition name="el-fade-in-linear">
|
|
||||||
<div v-show="showTimeLeft" class="cloud-record-time-process-title" :style="playTimeTitleStyle" >{{showPlayTimeTitle}}</div>
|
|
||||||
</transition>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="cloud-record-show-time">
|
|
||||||
{{showPlayTimeTotal}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div style="height: 40px; background-color: #383838; display: grid; grid-template-columns: 1fr 600px 1fr">
|
|
||||||
<div style="text-align: left;">
|
|
||||||
<div class="record-play-control" style="background-color: transparent; box-shadow: 0 0 10px transparent">
|
|
||||||
<a target="_blank" class="record-play-control-item iconfont icon-list" title="列表" @click="sidebarControl()" />
|
|
||||||
<a target="_blank" class="record-play-control-item iconfont icon-camera1196054easyiconnet" title="截图" @click="snap()" />
|
|
||||||
<!-- <a target="_blank" class="record-play-control-item iconfont icon-xiazai011" title="下载" @click="gbPause()" />-->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div style="text-align: center;">
|
|
||||||
<div class="record-play-control">
|
|
||||||
<a v-if="chooseFileIndex > 0" target="_blank" class="record-play-control-item iconfont icon-diyigeshipin" title="上一个" @click="playLast()" />
|
|
||||||
<a v-else style="color: #acacac; cursor: not-allowed" target="_blank" class="record-play-control-item iconfont icon-diyigeshipin" title="上一个" />
|
|
||||||
<a target="_blank" class="record-play-control-item iconfont icon-kuaijin" title="快退五秒" @click="seekBackward()" />
|
|
||||||
<a target="_blank" class="record-play-control-item iconfont icon-stop1" style="font-size: 14px" title="停止" @click="stopPLay()" />
|
|
||||||
<a v-if="playing" target="_blank" class="record-play-control-item iconfont icon-zanting" title="暂停" @click="pausePlay()" />
|
|
||||||
<a v-if="!playing" target="_blank" class="record-play-control-item iconfont icon-kaishi" title="播放" @click="play()" />
|
|
||||||
<a target="_blank" class="record-play-control-item iconfont icon-houtui" title="快进五秒" @click="seekForward()" />
|
|
||||||
<a v-if="chooseFileIndex < detailFiles.length - 1" target="_blank" class="record-play-control-item iconfont icon-zuihouyigeshipin" title="下一个" @click="playNext()" />
|
|
||||||
<a v-else style="color: #acacac; cursor: not-allowed" target="_blank" class="record-play-control-item iconfont icon-zuihouyigeshipin" title="下一个" @click="playNext()" />
|
|
||||||
<el-dropdown @command="changePlaySpeed">
|
|
||||||
<a target="_blank" class="record-play-control-item record-play-control-speed" title="倍速播放">{{ playSpeed }}X</a>
|
|
||||||
<el-dropdown-menu slot="dropdown">
|
|
||||||
<el-dropdown-item
|
|
||||||
v-for="item in playSpeedRange"
|
|
||||||
:key="item"
|
|
||||||
:command="item"
|
|
||||||
>{{ item }}X</el-dropdown-item>
|
|
||||||
</el-dropdown-menu>
|
|
||||||
</el-dropdown>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div style="text-align: right;">
|
|
||||||
<div class="record-play-control" style="background-color: transparent; box-shadow: 0 0 10px transparent">
|
|
||||||
<a v-if="!isFullScreen" target="_blank" class="record-play-control-item iconfont icon-fangdazhanshi" title="全屏" @click="fullScreen()" />
|
|
||||||
<a v-else target="_blank" class="record-play-control-item iconfont icon-suoxiao1" title="全屏" @click="fullScreen()" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -116,17 +55,17 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import h265web from '../common/h265web.vue'
|
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
import momentDurationFormatSetup from 'moment-duration-format'
|
import momentDurationFormatSetup from 'moment-duration-format'
|
||||||
import screenfull from 'screenfull'
|
import screenfull from 'screenfull'
|
||||||
|
import cloudRecordPlayer from './cloudRecordPlayer.vue'
|
||||||
|
|
||||||
momentDurationFormatSetup(moment)
|
momentDurationFormatSetup(moment)
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'CloudRecordDetail',
|
name: 'CloudRecordDetail',
|
||||||
components: {
|
components: {
|
||||||
h265web
|
cloudRecordPlayer
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -134,7 +73,7 @@ export default {
|
|||||||
app: this.$route.params.app,
|
app: this.$route.params.app,
|
||||||
stream: this.$route.params.stream,
|
stream: this.$route.params.stream,
|
||||||
mediaServerId: null,
|
mediaServerId: null,
|
||||||
dateFilesObj: [],
|
dateFilesObj: {},
|
||||||
mediaServerList: [],
|
mediaServerList: [],
|
||||||
detailFiles: [],
|
detailFiles: [],
|
||||||
videoUrl: null,
|
videoUrl: null,
|
||||||
@ -157,6 +96,8 @@ export default {
|
|||||||
initTime: null,
|
initTime: null,
|
||||||
timelineControl: false,
|
timelineControl: false,
|
||||||
showOtherSpeed: true,
|
showOtherSpeed: true,
|
||||||
|
lastBtnDiable: this.chooseFileIndex - 1 <= 0,
|
||||||
|
nextBtnDiable: false,
|
||||||
timeSegments: [],
|
timeSegments: [],
|
||||||
pickerOptions: {
|
pickerOptions: {
|
||||||
cellClassName: (date) => {
|
cellClassName: (date) => {
|
||||||
@ -184,44 +125,6 @@ export default {
|
|||||||
display: 'grid', gridTemplateColumns: '0 minmax(0, 1fr)'
|
display: 'grid', gridTemplateColumns: '0 minmax(0, 1fr)'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
showPlayTimeValue() {
|
|
||||||
if (this.streamInfo === null) {
|
|
||||||
return '--:--:--'
|
|
||||||
}else {
|
|
||||||
return moment.duration(this.playerTime, 'milliseconds').format('hh:mm:ss', {
|
|
||||||
trim: false
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
playTimeValue() {
|
|
||||||
return { width: this.playerTime/this.streamInfo.duration * 100 + '%' }
|
|
||||||
},
|
|
||||||
showPlayTimeTotal() {
|
|
||||||
if (this.streamInfo === null) {
|
|
||||||
return '--:--:--'
|
|
||||||
}else {
|
|
||||||
return moment.duration(this.streamInfo.duration, 'milliseconds').format('hh:mm:ss', {
|
|
||||||
trim: false
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
playTimeTotal() {
|
|
||||||
return { left: `calc(${this.playerTime/this.streamInfo.duration * 100}% - 6px)` }
|
|
||||||
},
|
|
||||||
playTimeTitleStyle() {
|
|
||||||
return { left: (this.showTimeLeft - 16) + 'px' }
|
|
||||||
},
|
|
||||||
showPlayTimeTitle() {
|
|
||||||
if (this.showTimeLeft) {
|
|
||||||
let time = this.showTimeLeft / this.$refs.timeProcess.clientWidth * this.streamInfo.duration
|
|
||||||
let chooseFile = this.detailFiles[this.chooseFileIndex]
|
|
||||||
let realTime = chooseFile.timeLen/this.streamInfo.duration * time + chooseFile.startTime
|
|
||||||
return `${moment(time).format('mm:ss')}(${moment(realTime).format('HH:mm:ss')})`
|
|
||||||
}else {
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@ -247,25 +150,8 @@ export default {
|
|||||||
timeProcessMousemove(event) {
|
timeProcessMousemove(event) {
|
||||||
|
|
||||||
},
|
},
|
||||||
timeProcessClick(event) {
|
sidebarControl(status) {
|
||||||
let x = event.offsetX
|
this.showSidebar = status
|
||||||
let clientWidth = this.$refs.timeProcess.clientWidth
|
|
||||||
this.seekRecord(x / clientWidth * this.streamInfo.duration)
|
|
||||||
},
|
|
||||||
timeProcessMousedown(event) {
|
|
||||||
this.isMousedown = true
|
|
||||||
},
|
|
||||||
timeProcessMouseEnter(event) {
|
|
||||||
this.showTimeLeft = event.offsetX
|
|
||||||
},
|
|
||||||
timeProcessMouseMove(event) {
|
|
||||||
this.showTimeLeft = event.offsetX
|
|
||||||
},
|
|
||||||
timeProcessMouseLeave(event) {
|
|
||||||
this.showTimeLeft = null
|
|
||||||
},
|
|
||||||
sidebarControl() {
|
|
||||||
this.showSidebar = !this.showSidebar
|
|
||||||
},
|
},
|
||||||
snap() {
|
snap() {
|
||||||
this.$refs.recordVideoPlayer.screenshot()
|
this.$refs.recordVideoPlayer.screenshot()
|
||||||
@ -280,42 +166,18 @@ export default {
|
|||||||
playNext() {
|
playNext() {
|
||||||
// 播放上一个
|
// 播放上一个
|
||||||
if (this.chooseFileIndex === this.detailFiles.length - 1) {
|
if (this.chooseFileIndex === this.detailFiles.length - 1) {
|
||||||
|
this.nextBtnDiable = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (this.chooseFileIndex < Object.values(this.dateFilesObj).length - 1) {
|
||||||
|
this.nextBtnDiable = true
|
||||||
|
}
|
||||||
this.chooseFile(this.chooseFileIndex + 1)
|
this.chooseFile(this.chooseFileIndex + 1)
|
||||||
},
|
|
||||||
changePlaySpeed(speed) {
|
|
||||||
// 倍速播放
|
|
||||||
this.playSpeed = speed
|
|
||||||
this.$store.dispatch('cloudRecord/speed', {
|
|
||||||
mediaServerId: this.streamInfo.mediaServerId,
|
|
||||||
app: this.streamInfo.app,
|
|
||||||
stream: this.streamInfo.stream,
|
|
||||||
key: this.streamInfo.key,
|
|
||||||
speed: this.playSpeed,
|
|
||||||
schema: 'ts'
|
|
||||||
})
|
|
||||||
this.$refs.recordVideoPlayer.setPlaybackRate(this.playSpeed)
|
|
||||||
},
|
|
||||||
seekBackward() {
|
|
||||||
// 快退五秒
|
|
||||||
this.seekRecord(this.playerTime - 5 * 1000)
|
|
||||||
},
|
|
||||||
seekForward() {
|
|
||||||
// 快进五秒
|
|
||||||
this.seekRecord(this.playerTime + 5 * 1000)
|
|
||||||
},
|
},
|
||||||
stopPLay() {
|
stopPLay() {
|
||||||
// 停止
|
// 停止
|
||||||
this.$refs.recordVideoPlayer.destroy()
|
this.$refs.cloudRecordPlayer.stopPLay()
|
||||||
this.streamInfo = null
|
|
||||||
this.playerTime = null
|
|
||||||
this.playSpeed = null
|
|
||||||
},
|
|
||||||
pausePlay() {
|
|
||||||
// 暂停
|
|
||||||
this.$refs.recordVideoPlayer.pause()
|
|
||||||
// TODO
|
|
||||||
},
|
},
|
||||||
play() {
|
play() {
|
||||||
if (this.$refs.recordVideoPlayer.loaded) {
|
if (this.$refs.recordVideoPlayer.loaded) {
|
||||||
@ -341,7 +203,7 @@ export default {
|
|||||||
this.isFullScreen = true
|
this.isFullScreen = true
|
||||||
},
|
},
|
||||||
dateChange() {
|
dateChange() {
|
||||||
this.$refs.recordVideoPlayer.destroy()
|
this.$refs.cloudRecordPlayer.stopPLay()
|
||||||
this.streamInfo = null
|
this.streamInfo = null
|
||||||
this.chooseFileIndex = null
|
this.chooseFileIndex = null
|
||||||
this.detailFiles = []
|
this.detailFiles = []
|
||||||
@ -406,10 +268,7 @@ export default {
|
|||||||
this.playRecord()
|
this.playRecord()
|
||||||
},
|
},
|
||||||
playRecord() {
|
playRecord() {
|
||||||
if (this.$refs.recordVideoPlayer.playing) {
|
this.$refs.cloudRecordPlayer.stopPLay()
|
||||||
this.$refs.recordVideoPlayer.destroy()
|
|
||||||
}
|
|
||||||
console.log(this.detailFiles[this.chooseFileIndex])
|
|
||||||
this.$store.dispatch('cloudRecord/loadRecord', {
|
this.$store.dispatch('cloudRecord/loadRecord', {
|
||||||
app: this.app,
|
app: this.app,
|
||||||
stream: this.stream,
|
stream: this.stream,
|
||||||
@ -417,12 +276,7 @@ export default {
|
|||||||
})
|
})
|
||||||
.then(data => {
|
.then(data => {
|
||||||
this.playerTime = 0
|
this.playerTime = 0
|
||||||
this.streamInfo = data
|
this.$refs.cloudRecordPlayer.setStreamInfo(data)
|
||||||
if (location.protocol === 'https:') {
|
|
||||||
this.videoUrl = data['wss_flv']
|
|
||||||
} else {
|
|
||||||
this.videoUrl = data['ws_flv']
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
@ -432,21 +286,6 @@ export default {
|
|||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
seekRecord(playSeekValue) {
|
|
||||||
this.$store.dispatch('cloudRecord/seek', {
|
|
||||||
mediaServerId: this.streamInfo.mediaServerId,
|
|
||||||
app: this.streamInfo.app,
|
|
||||||
stream: this.streamInfo.stream,
|
|
||||||
seek: playSeekValue,
|
|
||||||
schema: 'fmp4'
|
|
||||||
})
|
|
||||||
.then((data) => {
|
|
||||||
this.playerTime = playSeekValue
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.log(error)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
downloadFile(file) {
|
downloadFile(file) {
|
||||||
this.$store.dispatch('cloudRecord/getPlayPath', file.id)
|
this.$store.dispatch('cloudRecord/getPlayPath', file.id)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
@ -463,23 +302,9 @@ export default {
|
|||||||
console.log(error)
|
console.log(error)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
backToList() {
|
|
||||||
this.$router.back()
|
|
||||||
},
|
|
||||||
getFileShowName(item) {
|
getFileShowName(item) {
|
||||||
return moment(item.startTime).format('HH:mm:ss') + '-' + moment(item.endTime).format('HH:mm:ss')
|
return moment(item.startTime).format('HH:mm:ss') + '-' + moment(item.endTime).format('HH:mm:ss')
|
||||||
},
|
},
|
||||||
|
|
||||||
showPlayTimeChange(val) {
|
|
||||||
this.playerTime += val * 1000
|
|
||||||
},
|
|
||||||
playingChange(val) {
|
|
||||||
this.playing = val
|
|
||||||
if (!val) {
|
|
||||||
this.stopPLay()
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
getDateInYear(callback) {
|
getDateInYear(callback) {
|
||||||
this.dateFilesObj = {}
|
this.dateFilesObj = {}
|
||||||
this.$store.dispatch('cloudRecord/queryListByData', {
|
this.$store.dispatch('cloudRecord/queryListByData', {
|
||||||
@ -502,20 +327,15 @@ export default {
|
|||||||
console.log(error)
|
console.log(error)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
goBack() {
|
|
||||||
this.$router.push('/cloudRecord')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style scoped>
|
||||||
|
|
||||||
.record-list-box-box {
|
.record-list-box-box {
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.record-list-box {
|
.record-list-box {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
@ -617,7 +437,12 @@ export default {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
position: relative;
|
position: relative;
|
||||||
top: -35px;
|
top: -35px;
|
||||||
color: rgb(192 190 190);
|
color: rgb(217, 217, 217);
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
text-shadow:
|
||||||
|
-1px -1px 0 black, /* 左上角阴影 */
|
||||||
|
1px -1px 0 black, /* 右上角阴影 */
|
||||||
|
-1px 1px 0 black, /* 左下角阴影 */
|
||||||
|
1px 1px 0 black; /* 右下角阴影 */
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -117,32 +117,23 @@
|
|||||||
@current-change="currentChange"
|
@current-change="currentChange"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<el-dialog
|
<playerDialog ref="playerDialog"></playerDialog>
|
||||||
:title="playerTitle"
|
|
||||||
:visible.sync="showPlayer"
|
|
||||||
top="2rem"
|
|
||||||
width="1200px"
|
|
||||||
height="560px"
|
|
||||||
>
|
|
||||||
<h265web ref="recordVideoPlayer" :video-url="videoUrl" :height="false" :show-button="true" />
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import h265web from '../common/h265web.vue'
|
import playerDialog from './playerDialog.vue'
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'CloudRecord',
|
name: 'CloudRecord',
|
||||||
components: { h265web },
|
components: { playerDialog },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
search: '',
|
search: '',
|
||||||
startTime: '',
|
startTime: '',
|
||||||
endTime: '',
|
endTime: '',
|
||||||
showPlayer: false,
|
|
||||||
playerTitle: '',
|
playerTitle: '',
|
||||||
videoUrl: '',
|
videoUrl: '',
|
||||||
mediaServerList: [], // 滅体节点列表
|
mediaServerList: [], // 滅体节点列表
|
||||||
@ -216,20 +207,22 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
play(row) {
|
play(row) {
|
||||||
console.log(row)
|
|
||||||
this.chooseRecord = row
|
this.chooseRecord = row
|
||||||
this.$store.dispatch('cloudRecord/getPlayPath', row.id)
|
this.$refs.playerDialog.stopPlay()
|
||||||
.then((data) => {
|
this.$store.dispatch('cloudRecord/loadRecord', {
|
||||||
if (location.protocol === 'https:') {
|
app: row.app,
|
||||||
this.videoUrl = data.httpsPath
|
stream: row.stream,
|
||||||
} else {
|
cloudRecordId: row.id
|
||||||
this.videoUrl = data.httpPath
|
})
|
||||||
}
|
.then(data => {
|
||||||
this.showPlayer = true
|
this.$refs.playerDialog.openDialog(data)
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
})
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.playLoading = false
|
||||||
|
})
|
||||||
},
|
},
|
||||||
downloadFile(row) {
|
downloadFile(row) {
|
||||||
this.$store.dispatch('cloudRecord/getPlayPath', row.id)
|
this.$store.dispatch('cloudRecord/getPlayPath', row.id)
|
||||||
@ -328,6 +321,6 @@ export default {
|
|||||||
|
|
||||||
<style>
|
<style>
|
||||||
.el-dialog__body {
|
.el-dialog__body {
|
||||||
padding: 30px 0 !important;
|
padding: 20px 0 0 0 !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
58
web/src/views/cloudRecord/playerDialog.vue
Normal file
58
web/src/views/cloudRecord/playerDialog.vue
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
<template>
|
||||||
|
<div id="playerDialog" >
|
||||||
|
<el-dialog
|
||||||
|
v-el-drag-dialog
|
||||||
|
top="2rem"
|
||||||
|
width="1460px"
|
||||||
|
height="400px"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:visible.sync="showDialog"
|
||||||
|
:destroy-on-close="true"
|
||||||
|
@close="close()"
|
||||||
|
>
|
||||||
|
<cloudRecordPlayer ref="cloudRecordPlayer" ></cloudRecordPlayer>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import elDragDialog from '@/directive/el-drag-dialog'
|
||||||
|
import cloudRecordPlayer from './cloudRecordPlayer.vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'PlayerDialog',
|
||||||
|
components: { cloudRecordPlayer },
|
||||||
|
directives: { elDragDialog },
|
||||||
|
props: {},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
showDialog: false,
|
||||||
|
streamInfo: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
created() {},
|
||||||
|
methods: {
|
||||||
|
openDialog: function(streamInfo) {
|
||||||
|
console.log(streamInfo)
|
||||||
|
this.showDialog = true
|
||||||
|
this.streamInfo = streamInfo
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.cloudRecordPlayer.setStreamInfo(streamInfo)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
stopPlay: function() {
|
||||||
|
if (this.$refs.cloudRecordPlayer) {
|
||||||
|
this.$refs.cloudRecordPlayer.stopPLay()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
close: function() {
|
||||||
|
if (this.$refs.cloudRecordPlayer) {
|
||||||
|
this.$refs.cloudRecordPlayer.stopPLay()
|
||||||
|
}
|
||||||
|
this.showDialog = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@ -1,10 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="h265Player" ref="container" style="background-color: #000000; " @dblclick="fullscreenSwich">
|
<div id="h265Player" ref="container" style="background-color: #000000; " @dblclick="fullscreenSwich">
|
||||||
<div id="glplayer" ref="playerBox" style="width: 100%; height: 100%; margin: 0 auto;" />
|
<div id="glplayer" ref="playerBox" style="width: 100%; height: 100%; margin: 0 auto;" >
|
||||||
<div v-if="playerLoading" class="player-loading">
|
<div v-if="playerLoading" class="play-loading">
|
||||||
<i class="el-icon-loading" />
|
<i class="el-icon-loading" />
|
||||||
<span>视频加载中</span>
|
视频加载中
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="showButton" id="buttonsBox" class="buttons-box">
|
<div v-if="showButton" id="buttonsBox" class="buttons-box">
|
||||||
<div class="buttons-box-left">
|
<div class="buttons-box-left">
|
||||||
<i v-if="!playing" class="iconfont icon-play h265web-btn" @click="unPause" />
|
<i v-if="!playing" class="iconfont icon-play h265web-btn" @click="unPause" />
|
||||||
@ -265,6 +267,16 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.play-loading {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin: 0 auto;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
.buttons-box {
|
.buttons-box {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 28px;
|
height: 28px;
|
||||||
|
|||||||
@ -49,7 +49,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="playerBox">
|
<div id="playerBox" style="width: 100%">
|
||||||
<div class="playBox" style="height: calc(100% - 90px); width: 100%; background-color: #000000">
|
<div class="playBox" style="height: calc(100% - 90px); width: 100%; background-color: #000000">
|
||||||
<div
|
<div
|
||||||
v-if="playLoading"
|
v-if="playLoading"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user