修复云端录像播放页面
This commit is contained in:
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 id="playerBox">
|
||||
<div class="playBox" style="height: calc(100vh - 190px); width: 100%; background-color: #000000">
|
||||
<div v-if="playLoading" style="position: relative; left: calc(50% - 32px); top: 43%; z-index: 100;color: #fff;float: left; text-align: center;">
|
||||
<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>
|
||||
<cloudRecordPlayer ref="cloudRecordPlayer" :showListCallback="sidebarControl" :showNextCallback="playNext"
|
||||
:showLastCallback="playLast" :lastDiable="lastBtnDiable" :nextDiable="nextBtnDiable" ></cloudRecordPlayer>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -116,17 +55,17 @@
|
||||
|
||||
<script>
|
||||
|
||||
import h265web from '../common/h265web.vue'
|
||||
import moment from 'moment'
|
||||
import momentDurationFormatSetup from 'moment-duration-format'
|
||||
import screenfull from 'screenfull'
|
||||
import cloudRecordPlayer from './cloudRecordPlayer.vue'
|
||||
|
||||
momentDurationFormatSetup(moment)
|
||||
|
||||
export default {
|
||||
name: 'CloudRecordDetail',
|
||||
components: {
|
||||
h265web
|
||||
cloudRecordPlayer
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -134,7 +73,7 @@ export default {
|
||||
app: this.$route.params.app,
|
||||
stream: this.$route.params.stream,
|
||||
mediaServerId: null,
|
||||
dateFilesObj: [],
|
||||
dateFilesObj: {},
|
||||
mediaServerList: [],
|
||||
detailFiles: [],
|
||||
videoUrl: null,
|
||||
@@ -157,6 +96,8 @@ export default {
|
||||
initTime: null,
|
||||
timelineControl: false,
|
||||
showOtherSpeed: true,
|
||||
lastBtnDiable: this.chooseFileIndex - 1 <= 0,
|
||||
nextBtnDiable: false,
|
||||
timeSegments: [],
|
||||
pickerOptions: {
|
||||
cellClassName: (date) => {
|
||||
@@ -184,44 +125,6 @@ export default {
|
||||
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() {
|
||||
@@ -247,25 +150,8 @@ export default {
|
||||
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
|
||||
sidebarControl(status) {
|
||||
this.showSidebar = status
|
||||
},
|
||||
snap() {
|
||||
this.$refs.recordVideoPlayer.screenshot()
|
||||
@@ -280,42 +166,18 @@ export default {
|
||||
playNext() {
|
||||
// 播放上一个
|
||||
if (this.chooseFileIndex === this.detailFiles.length - 1) {
|
||||
this.nextBtnDiable = true
|
||||
return
|
||||
}
|
||||
if (this.chooseFileIndex < Object.values(this.dateFilesObj).length - 1) {
|
||||
this.nextBtnDiable = true
|
||||
}
|
||||
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() {
|
||||
// 停止
|
||||
this.$refs.recordVideoPlayer.destroy()
|
||||
this.streamInfo = null
|
||||
this.playerTime = null
|
||||
this.playSpeed = null
|
||||
},
|
||||
pausePlay() {
|
||||
// 暂停
|
||||
this.$refs.recordVideoPlayer.pause()
|
||||
// TODO
|
||||
this.$refs.cloudRecordPlayer.stopPLay()
|
||||
},
|
||||
play() {
|
||||
if (this.$refs.recordVideoPlayer.loaded) {
|
||||
@@ -341,7 +203,7 @@ export default {
|
||||
this.isFullScreen = true
|
||||
},
|
||||
dateChange() {
|
||||
this.$refs.recordVideoPlayer.destroy()
|
||||
this.$refs.cloudRecordPlayer.stopPLay()
|
||||
this.streamInfo = null
|
||||
this.chooseFileIndex = null
|
||||
this.detailFiles = []
|
||||
@@ -406,10 +268,7 @@ export default {
|
||||
this.playRecord()
|
||||
},
|
||||
playRecord() {
|
||||
if (this.$refs.recordVideoPlayer.playing) {
|
||||
this.$refs.recordVideoPlayer.destroy()
|
||||
}
|
||||
console.log(this.detailFiles[this.chooseFileIndex])
|
||||
this.$refs.cloudRecordPlayer.stopPLay()
|
||||
this.$store.dispatch('cloudRecord/loadRecord', {
|
||||
app: this.app,
|
||||
stream: this.stream,
|
||||
@@ -417,12 +276,7 @@ export default {
|
||||
})
|
||||
.then(data => {
|
||||
this.playerTime = 0
|
||||
this.streamInfo = data
|
||||
if (location.protocol === 'https:') {
|
||||
this.videoUrl = data['wss_flv']
|
||||
} else {
|
||||
this.videoUrl = data['ws_flv']
|
||||
}
|
||||
this.$refs.cloudRecordPlayer.setStreamInfo(data)
|
||||
})
|
||||
.catch((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) {
|
||||
this.$store.dispatch('cloudRecord/getPlayPath', file.id)
|
||||
.then(data => {
|
||||
@@ -463,23 +302,9 @@ export default {
|
||||
console.log(error)
|
||||
})
|
||||
},
|
||||
backToList() {
|
||||
this.$router.back()
|
||||
},
|
||||
getFileShowName(item) {
|
||||
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) {
|
||||
this.dateFilesObj = {}
|
||||
this.$store.dispatch('cloudRecord/queryListByData', {
|
||||
@@ -502,20 +327,15 @@ export default {
|
||||
console.log(error)
|
||||
})
|
||||
},
|
||||
goBack() {
|
||||
this.$router.push('/cloudRecord')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
<style scoped>
|
||||
.record-list-box-box {
|
||||
width: fit-content;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.record-list-box {
|
||||
width: 100%;
|
||||
overflow: auto;
|
||||
@@ -617,7 +437,12 @@ export default {
|
||||
text-align: center;
|
||||
position: relative;
|
||||
top: -35px;
|
||||
color: rgb(192 190 190);
|
||||
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>
|
||||
|
||||
@@ -117,32 +117,23 @@
|
||||
@current-change="currentChange"
|
||||
/>
|
||||
</div>
|
||||
<el-dialog
|
||||
:title="playerTitle"
|
||||
:visible.sync="showPlayer"
|
||||
top="2rem"
|
||||
width="1200px"
|
||||
height="560px"
|
||||
>
|
||||
<h265web ref="recordVideoPlayer" :video-url="videoUrl" :height="false" :show-button="true" />
|
||||
</el-dialog>
|
||||
<playerDialog ref="playerDialog"></playerDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import h265web from '../common/h265web.vue'
|
||||
import playerDialog from './playerDialog.vue'
|
||||
import moment from 'moment'
|
||||
import Vue from 'vue'
|
||||
|
||||
export default {
|
||||
name: 'CloudRecord',
|
||||
components: { h265web },
|
||||
components: { playerDialog },
|
||||
data() {
|
||||
return {
|
||||
search: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
showPlayer: false,
|
||||
playerTitle: '',
|
||||
videoUrl: '',
|
||||
mediaServerList: [], // 滅体节点列表
|
||||
@@ -216,20 +207,22 @@ export default {
|
||||
})
|
||||
},
|
||||
play(row) {
|
||||
console.log(row)
|
||||
this.chooseRecord = row
|
||||
this.$store.dispatch('cloudRecord/getPlayPath', row.id)
|
||||
.then((data) => {
|
||||
if (location.protocol === 'https:') {
|
||||
this.videoUrl = data.httpsPath
|
||||
} else {
|
||||
this.videoUrl = data.httpPath
|
||||
}
|
||||
this.showPlayer = true
|
||||
this.$refs.playerDialog.stopPlay()
|
||||
this.$store.dispatch('cloudRecord/loadRecord', {
|
||||
app: row.app,
|
||||
stream: row.stream,
|
||||
cloudRecordId: row.id
|
||||
})
|
||||
.then(data => {
|
||||
this.$refs.playerDialog.openDialog(data)
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
.finally(() => {
|
||||
this.playLoading = false
|
||||
})
|
||||
},
|
||||
downloadFile(row) {
|
||||
this.$store.dispatch('cloudRecord/getPlayPath', row.id)
|
||||
@@ -328,6 +321,6 @@ export default {
|
||||
|
||||
<style>
|
||||
.el-dialog__body {
|
||||
padding: 30px 0 !important;
|
||||
padding: 20px 0 0 0 !important;
|
||||
}
|
||||
</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>
|
||||
Reference in New Issue
Block a user