优化abl云端录像播放效果

This commit is contained in:
lin
2025-09-22 14:31:04 +08:00
parent 15ff87a323
commit 3a594f7bee
6 changed files with 20 additions and 14 deletions

View File

@@ -489,7 +489,7 @@ public class ABLMediaNodeServerService implements IMediaNodeServerService {
@Override @Override
public void seekRecordStamp(MediaServer mediaServer, String app, String stream, Double stamp, String schema) { public void seekRecordStamp(MediaServer mediaServer, String app, String stream, Double stamp, String schema) {
ABLResult ablResult = ablresTfulUtils.controlRecordPlay(mediaServer, app, stream, "seek", "120"); ABLResult ablResult = ablresTfulUtils.controlRecordPlay(mediaServer, app, stream, "seek", stamp/1000 + "");
if (ablResult.getCode() != 0) { if (ablResult.getCode() != 0) {
log.warn("[abl-seek] 失败:{}", ablResult.getMemo()); log.warn("[abl-seek] 失败:{}", ablResult.getMemo());
} }

View File

@@ -527,7 +527,7 @@ public class ABLRESTfulUtils {
param.put("app", app); param.put("app", app);
param.put("stream", stream); param.put("stream", stream);
param.put("command", command); param.put("command", command);
param.put("value", Long.valueOf(value)); param.put("value", value);
String response = sendGet(mediaServer, "controlRecordPlay", param); String response = sendGet(mediaServer, "controlRecordPlay", param);
ABLResult ablResult = JSON.parseObject(response, ABLResult.class); ABLResult ablResult = JSON.parseObject(response, ABLResult.class);
if (ablResult == null) { if (ablResult == null) {

View File

@@ -40,7 +40,7 @@
<a target="_blank" class="cloud-record-record-play-control-item iconfont icon-houtui" title="快进五秒" @click="seekForward()" /> <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-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()" /> <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"> <el-dropdown @command="changePlaySpeed" :popper-append-to-body='false' >
<a target="_blank" class="cloud-record-record-play-control-item record-play-control-speed" title="倍速播放">{{ playSpeed }}X</a> <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-menu slot="dropdown">
<el-dropdown-item <el-dropdown-item
@@ -82,6 +82,8 @@ export default {
showSidebar: false, showSidebar: false,
videoUrl: null, videoUrl: null,
streamInfo: null, streamInfo: null,
timeLen: null,
startTime: null,
showTimeLeft: null, showTimeLeft: null,
isMousedown: false, isMousedown: false,
loading: false, loading: false,
@@ -97,7 +99,7 @@ export default {
computed: { computed: {
playBoxStyle() { playBoxStyle() {
return { return {
height: this.isFullScreen ? 'calc(100vh - 61px)' : 'calc(100vh - 190px)' height: this.isFullScreen ? 'calc(100vh - 61px)' : 'calc(100vh - 164px)'
} }
}, },
showPlayTimeValue() { showPlayTimeValue() {
@@ -126,8 +128,7 @@ export default {
showPlayTimeTitle() { showPlayTimeTitle() {
if (this.showTimeLeft) { if (this.showTimeLeft) {
let time = this.showTimeLeft / this.$refs.timeProcess.clientWidth * this.streamInfo.duration let time = this.showTimeLeft / this.$refs.timeProcess.clientWidth * this.streamInfo.duration
let chooseFile = this.detailFiles[this.chooseFileIndex] let realTime = this.timeLen/this.streamInfo.duration * time + this.startTime
let realTime = chooseFile.timeLen/this.streamInfo.duration * time + chooseFile.startTime
return `${moment(time).format('mm:ss')}(${moment(realTime).format('HH:mm:ss')})` return `${moment(time).format('mm:ss')}(${moment(realTime).format('HH:mm:ss')})`
}else { }else {
return '' return ''
@@ -202,7 +203,7 @@ export default {
}, },
stopPLay() { stopPLay() {
// 停止 // 停止
if (this.$refs.recordVideoPlayer.playing) { if (this.$refs.recordVideoPlayer) {
this.$refs.recordVideoPlayer.destroy() this.$refs.recordVideoPlayer.destroy()
} }
this.streamInfo = null this.streamInfo = null
@@ -230,20 +231,22 @@ export default {
} }
const playerWidth = this.$refs.recordVideoPlayer.playerWidth const playerWidth = this.$refs.recordVideoPlayer.playerWidth
const playerHeight = this.$refs.recordVideoPlayer.playerHeight const playerHeight = this.$refs.recordVideoPlayer.playerHeight
screenfull.request(document.getElementById('playerBox')) screenfull.request(document.getElementById('cloudRecordPlayer'))
screenfull.on('change', (event) => { screenfull.on('change', (event) => {
this.$refs.recordVideoPlayer.resize(playerWidth, playerHeight) this.$refs.recordVideoPlayer.resize(playerWidth, playerHeight)
this.isFullScreen = screenfull.isFullscreen this.isFullScreen = screenfull.isFullscreen
}) })
this.isFullScreen = true this.isFullScreen = true
}, },
setStreamInfo(streamInfo) { setStreamInfo(streamInfo, timeLen, startTime) {
if (location.protocol === 'https:') { if (location.protocol === 'https:') {
this.videoUrl = streamInfo['wss_flv'] this.videoUrl = streamInfo['wss_flv']
} else { } else {
this.videoUrl = streamInfo['ws_flv'] this.videoUrl = streamInfo['ws_flv']
} }
this.streamInfo = streamInfo this.streamInfo = streamInfo
this.timeLen = timeLen
this.startTime = startTime
}, },
seekRecord(playSeekValue) { seekRecord(playSeekValue) {
this.$store.dispatch('cloudRecord/seek', { this.$store.dispatch('cloudRecord/seek', {

View File

@@ -1,5 +1,5 @@
<template> <template>
<div id="recordDetail" class="app-container"> <div id="recordDetail" style="padding: 10px 20px">
<div :style="boxStyle"> <div :style="boxStyle">
<div> <div>
<div v-if="this.$route.query.mediaServerId" class="page-header-btn" style="padding-right: 1rem"> <div v-if="this.$route.query.mediaServerId" class="page-header-btn" style="padding-right: 1rem">
@@ -276,7 +276,7 @@ export default {
}) })
.then(data => { .then(data => {
this.playerTime = 0 this.playerTime = 0
this.$refs.cloudRecordPlayer.setStreamInfo(data) this.$refs.cloudRecordPlayer.setStreamInfo(data, this.detailFiles[this.chooseFileIndex].timeLen, this.detailFiles[this.chooseFileIndex].startTime)
}) })
.catch((error) => { .catch((error) => {
console.log(error) console.log(error)

View File

@@ -215,7 +215,7 @@ export default {
cloudRecordId: row.id cloudRecordId: row.id
}) })
.then(data => { .then(data => {
this.$refs.playerDialog.openDialog(data) this.$refs.playerDialog.openDialog(data, row.timeLen, row.startTime)
}) })
.catch((error) => { .catch((error) => {
console.log(error) console.log(error)

View File

@@ -5,6 +5,9 @@
top="2rem" top="2rem"
width="1460px" width="1460px"
height="400px" height="400px"
:append-to-body="false"
:modal-append-to-body="false"
:modal="false"
:close-on-click-modal="false" :close-on-click-modal="false"
:visible.sync="showDialog" :visible.sync="showDialog"
:destroy-on-close="true" :destroy-on-close="true"
@@ -34,12 +37,12 @@ export default {
computed: {}, computed: {},
created() {}, created() {},
methods: { methods: {
openDialog: function(streamInfo) { openDialog: function(streamInfo, timeLen, startTime) {
console.log(streamInfo) console.log(streamInfo)
this.showDialog = true this.showDialog = true
this.streamInfo = streamInfo this.streamInfo = streamInfo
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.cloudRecordPlayer.setStreamInfo(streamInfo) this.$refs.cloudRecordPlayer.setStreamInfo(streamInfo, timeLen, startTime)
}) })
}, },
stopPlay: function() { stopPlay: function() {