playback.vue
1.6 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
<template>
<div class="vion-playerback">
<!-- 回放 -->
<iframe ref="vplayer" src="/jplayer/playback.html?ip=52.130.155.147&id=20000000001310000011-1693877405111-1693923756111-1-0" frameborder="0"></iframe>
<div class="footer">
<button @click="handleStop">停止播放</button>
<!-- <button @click="handleScreenshot">抓拍</button> -->
</div>
</div>
</template>
<script>
export default {
name: 'VionPlayback',
data() {
return {
// eslint-disable-next-line
_playerEl: null,
}
},
mounted() {
this.init();
},
methods: {
init() {
this._playerEl = this.$refs.vplayer;
console.log('vplayer', this._playerEl);
},
handleStop() {
this._playerEl.contentWindow.stopPlayer();
},
/* handleScreenshot() {
const imgData = this._playerEl.contentWindow.screenshotBase64();
console.log('handleScreenshot', imgData);
}, */
handlePlayback() {
// http://localhost:8080/jplayer/index.html?ip=52.130.155.147&id=20000000001310000005
console.log('handlePlayback');
const ip = '52.130.155.147';
const id = '20000000001310000005';
// Tue Sep 05 2023 18:00:13 GMT+0800 (中国标准时间)
const st = '1693908039201';
// 当前时间
const et = new Date().getTime();
const location = 1;
this._playerEl.src = `/jplayer/index.html?ip=${ip}&id=${id}-${st}-${et}-${location}-0`;
},
}
}
</script>
<style scoped lang="scss">
.vion-playerback {
> iframe {
width: 800px;
height: 480px;
}
.footer {
> button {
margin-right: 10px;
}
}
}
</style>