报警回放支持播放器切换

This commit is contained in:
lin 2026-06-16 10:31:34 +08:00
parent 0c7701d36f
commit 5f50d4c96f

View File

@ -161,11 +161,11 @@
<i class="el-icon-warning-outline" style="font-size: 32px;" /> <i class="el-icon-warning-outline" style="font-size: 32px;" />
<div style="margin-top: 10px;">{{ playbackError }}</div> <div style="margin-top: 10px;">{{ playbackError }}</div>
</div> </div>
<div v-else-if="playbackStreamInfo"> <div v-else-if="playbackStreamInfo" style="height: 400px;">
<h265web <playerTabs
ref="playbackPlayer" ref="playbackPlayer"
:height="'400px'"
:show-button="false" :show-button="false"
:showTab="true"
:has-audio="true" :has-audio="true"
/> />
</div> </div>
@ -177,7 +177,7 @@
</template> </template>
<script> <script>
import h265web from '../common/h265web.vue' import playerTabs from '../common/playerTabs.vue'
const ALARM_TYPE_OPTIONS = [ const ALARM_TYPE_OPTIONS = [
{ value: 'VideoLoss', label: '视频丢失报警' }, { value: 'VideoLoss', label: '视频丢失报警' },
@ -221,7 +221,7 @@ function formatDatetime(ts) {
export default { export default {
name: 'AlarmManage', name: 'AlarmManage',
components: { h265web }, components: { playerTabs },
data() { data() {
return { return {
alarmList: [], alarmList: [],
@ -238,7 +238,6 @@ export default {
playbackLoading: false, playbackLoading: false,
playbackError: null, playbackError: null,
playbackStreamInfo: null, playbackStreamInfo: null,
playbackVideoUrl: null,
playbackTitle: '录像回放', playbackTitle: '录像回放',
currentPlaybackChannelId: null currentPlaybackChannelId: null
} }
@ -308,15 +307,10 @@ export default {
endTime: endTime endTime: endTime
}).then(data => { }).then(data => {
this.playbackStreamInfo = data this.playbackStreamInfo = data
if (location.protocol === 'https:') {
this.playbackVideoUrl = data['wss_flv']
} else {
this.playbackVideoUrl = data['ws_flv']
}
this.playbackLoading = false this.playbackLoading = false
this.$nextTick(() => { this.$nextTick(() => {
if (this.$refs.playbackPlayer) { if (this.$refs.playbackPlayer) {
this.$refs.playbackPlayer.play(this.playbackVideoUrl) this.$refs.playbackPlayer.setStreamInfo(data)
} }
}) })
}).catch(err => { }).catch(err => {
@ -326,6 +320,9 @@ export default {
}) })
}, },
closePlayback() { closePlayback() {
if (this.$refs.playbackPlayer) {
this.$refs.playbackPlayer.stop()
}
if (this.playbackStreamInfo && this.currentPlaybackChannelId) { if (this.playbackStreamInfo && this.currentPlaybackChannelId) {
this.$store.dispatch('commonChanel/stopPlayback', { this.$store.dispatch('commonChanel/stopPlayback', {
channelId: this.currentPlaybackChannelId, channelId: this.currentPlaybackChannelId,
@ -336,7 +333,6 @@ export default {
} }
this.playbackDialogVisible = false this.playbackDialogVisible = false
this.playbackStreamInfo = null this.playbackStreamInfo = null
this.playbackVideoUrl = null
this.playbackError = null this.playbackError = null
this.currentPlaybackChannelId = null this.currentPlaybackChannelId = null
}, },