index.vue
1.06 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
<template>
<div class="vion-player">
<!-- http://localhost:8080/jplayer -->
<iframe ref="vplayer" src="/jplayer/index.html?ip=52.130.155.147&id=20000000001310000005" frameborder="0"></iframe>
<div class="footer">
<button @click="handleStop">停止播放</button>
<button @click="handleScreenshot">抓拍</button>
</div>
</div>
</template>
<script>
export default {
name: 'VionPlayer',
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);
},
},
}
</script>
<style scoped lang="scss">
.vion-player {
> iframe {
width: 800px;
height: 480px;
}
.footer {
> button {
margin-right: 10px;
}
}
}
</style>