HistoryPlayDialog.vue
4.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<template>
<el-dialog
:close-on-click-modal="true"
:title="`${data.deviceId} 设备 - ${data.channelName} 历史视频回放`"
:visible.sync="open"
width="90%"
center
append-to-body
@opened="onDialogOpened"
>
<el-container>
<el-main style="display: flex;justify-content: center;align-items: center;background-color: #e9eef3;">
<el-card class="box-card" shadow="always" :body-style="{ height: '100%', padding: '10px' }">
<div class="main-play">
<jess-video-player
v-if="videoUrl"
ref="histPlayer"
:key="'hist-' + playSessionKey"
class="hist-jess-player"
:initial-play-url="videoUrl"
:vod="true"
:jessibuca-timeout="60"
:ui-play-timeout-sec="45"
:player-auto-resize="true"
/>
</div>
</el-card>
</el-main>
</el-container>
<el-footer style="padding: 0;background-color: #2b2f33;">
<TimeLine
ref="time_line"
@change="changeDate"
:width="width"
:mark-time="markTime"
:time-range="time_range"
:isAutoPlay="isAutoPlay"
:startMeddleTime="startMeddleTime"
@click="clickCanvas"
/>
</el-footer>
<span slot="footer" class="dialog-footer">
<el-button @click="handleClose">取 消</el-button>
</span>
</el-dialog>
</template>
<script>
import JessVideoPlayer from '../common/JessVideoPlayer.vue'
import TimeLine from './TimeLineCanvas.vue'
export default {
name: 'HistoryPlayDialog',
components: { TimeLine, JessVideoPlayer },
data() {
return {
data: {},
videoUrl: null,
isAutoPlay: false,
width: '100%',
startMeddleTime: null,
startTime: null,
endTime: null,
time_range: [],
markTime: [],
form: {
code: '',
startTime: '',
endTime: ''
},
open: false,
playSessionKey: 0
}
},
watch: {
data(val) {
if (!val || !val.videoUrl) return
this.playSessionKey += 1
this.videoUrl = val.videoUrl
this.startMeddleTime = val.startTime
this.startTime = val.startTime
this.endTime = val.endTime
this.time_range = [val.startTime, val.endTime]
this.markTime = [
{
beginTime: val.startTime,
endTime: val.endTime,
bgColor: 'green',
text: '有视频'
}
]
this.form.startTime = this.startTime
this.form.endTime = this.endTime
this.$nextTick(() => {
const p = this.$refs.histPlayer
if (p && typeof p.tryResize === 'function') p.tryResize()
})
},
videoUrl() {
this.$nextTick(() => {
const p = this.$refs.histPlayer
if (p && typeof p.tryResize === 'function') p.tryResize()
})
}
},
methods: {
onDialogOpened() {
this.$nextTick(() => {
const p = this.$refs.histPlayer
if (p && typeof p.tryResize === 'function') p.tryResize()
})
},
updateOpen(flag) {
this.open = flag
},
clickCanvas(date) {
const map = this.data.channelMapping != null ? String(this.data.channelMapping) : ''
this.$axios({
method: 'get',
url: '/api/jt1078/query/send/request/io/history/' + this.data.sim + '/' + this.data.channel + '/' + this.data.startTime + '/' + date + '/' + encodeURIComponent(map)
}).then(res => {
if (res.data && res.data.data && res.data.data.data) {
const d = res.data.data.data
const videoUrl1 = location.protocol === 'https:'
? (d.wss_flv || d.ws_flv || d.flv)
: (d.ws_flv || d.wss_flv || d.flv)
if (videoUrl1) {
this.playSessionKey += 1
this.videoUrl = videoUrl1
}
} else if (res.data.data && res.data.data.msg) {
this.$message.error(res.data.data.msg)
} else if (res.data.msg) {
this.$message.error(res.data.msg)
}
})
},
changeDate(date, status) {
console.log('选择时间:' + date + ' 播放状态:' + status)
},
handleClose() {
this.open = false
}
}
}
</script>
<style scoped>
.main-play {
width: 100%;
height: 500px;
background-color: #000000;
}
.hist-jess-player {
width: 100%;
height: 100%;
}
.box-card {
width: 100%;
max-width: 1280px;
}
</style>