demo-h5.html
2.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DemoH5</title>
<style>
body {
display: flex;
flex-direction: column;
align-items: center;
}
.demo-h5-player {
width: 375px;
height: 680px;
outline: 1px solid #CCC;
}
.footer {
height: 30px;
line-height: 30px;
text-align: center;
margin-top: 10px;
}
</style>
</head>
<body>
<div class="demo-h5-player">
<iframe id="player" src="/vion-player/#/vionplayer-extension"
frameborder="0"
height="100%"
width="100%"
>
</iframe>
</div>
<div class="footer">
<div class="play-part" style="display: inline-block;">
<input id="unid" type="text" value="7c55b448-5857-11ee-8777-00163e143ecd">
<button id="play">播放</button>
</div>
<button id="stop">停止</button>
<button id="screenshot">截图</button>
</div>
<script>
var $playBtn = document.getElementById('play');
var $stopBtn = document.getElementById('stop');
var $screenshotBtn = document.getElementById('screenshot');
var $player = document.getElementById('player');
var $playUnid = document.getElementById('unid');
// 播放
$playBtn.addEventListener('click', function () {
console.log('playBtn', $player, $playUnid.value);
$player.contentWindow.playWebVideo({ gateUnid: $playUnid.value })
}, false);
// 停止
$stopBtn.addEventListener('click', function () {
console.log('stopBtn', $player);
$player.contentWindow.stopPlay();
}, false);
// 截图
$screenshotBtn.addEventListener('click', function () {
console.log('screenshotBtn', $player, $player.contentWindow.screenshot);
$player.contentWindow.screenshot().then(data => {
console.log('screenshotData', data);
})
}, false);
</script>
</body>
</html>