-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
109 lines (97 loc) · 2.73 KB
/
index.html
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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
.iframe_container {
background-color: black;
height: 480px;
width: 812px;
}
</style>
</head>
<body>
<div class="iframe_container">
<div
style="
position: relative;
padding-bottom: 56.25%;
height: 0;
overflow: hidden;
"
>
<iframe
id="player"
src="http://localhost:8080"
style="
border: none;
position: absolute;
top: 0;
height: 100%;
width: 100%;
"
allow="accelerometer;gyroscope;autoplay;encrypted-media;picture-in-picture"
allowfullscreen="true"
loading="lazy"
webkitallowfullscreen="true"
mozallowfullscreen="true"
>
>
</iframe>
</div>
</div>
<button id="setCurrentTime">Set Current Time</button>
<button id="play">Play</button>
<button id="pause">Pause</button>
<!-- mute -->
<button id="mute">Mute</button>
<button id="unmute">Unmute</button>
<script src="/dist/player.js"></script>
<script>
const iframe = document.querySelector('#player')
const player = new Gotipath.Player(iframe)
// native events
player.on('ready', function () {
player.setCurrentTime(200)
console.log('player is ready!')
})
player.on('play', function (e) {
console.log('played the video!')
})
player.on('pause', function (e) {
console.log('paused the video!')
})
player.on('ended', function (e) {
console.log('ended the video!', e)
})
player.on('timeupdate', function (e) {
console.log('current time:', e)
})
player.on('volumechange', function (e) {
console.log('volume changed to:', e)
})
var btn = document.getElementById('setCurrentTime')
var playBtn = document.getElementById('play')
var pauseBtn = document.getElementById('pause')
playBtn.addEventListener('click', function () {
player.play()
})
pauseBtn.addEventListener('click', function () {
player.pause()
})
btn.addEventListener('click', function () {
player.setCurrentTime(200)
})
var muteBtn = document.getElementById('mute')
var unmuteBtn = document.getElementById('unmute')
muteBtn.addEventListener('click', function () {
player.mute()
})
unmuteBtn.addEventListener('click', function () {
player.unmute()
})
</script>
</body>
</html>