This repository has been archived by the owner on May 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
146 lines (120 loc) · 3.43 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
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
<!doctype html>
<title><jwplayer-video></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css"
/>
<style>
body {
text-align: center;
padding-bottom: 5rem;
}
media-controller,
jwplayer-video {
display: block;
width: 100%;
aspect-ratio: 16 / 9;
background: #000;
}
</style>
<script type="importmap">
{
"imports": {
"super-media-element": "https://cdn.jsdelivr.net/npm/super-media-element@1.2"
}
}
</script>
<script type="module" src="./jwplayer-video-element.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/media-chrome/+esm"></script>
<h1><jwplayer-video></h1>
<br>
<jwplayer-video
controls
loop
muted
></jwplayer-video>
<script>
let video = document.querySelector('jwplayer-video');
video.src = "https://cdn.jwplayer.com/players/C8YE48zj-IxzuqJ4M.html";
</script>
<br>
<button id="loadbtn">Load new clip</button>
<script>
video = document.querySelector('jwplayer-video');
loadbtn.onclick = () => {
video.src = 'https://cdn.jwplayer.com/players/R12Nj7bO-Pd4r8gwe.html';
}
video.addEventListener('emptied', (e) => {
console.log(e.type);
});
video.addEventListener('loadstart', (e) => {
console.log(e.type);
});
video.addEventListener('loadedmetadata', (e) => {
console.log(e.type);
});
video.addEventListener('loadeddata', (e) => {
console.log(e.type);
});
video.addEventListener('play', (e) => {
console.log(e.type);
});
video.addEventListener('waiting', (e) => {
console.log(e.type);
});
video.addEventListener('playing', (e) => {
console.log(e.type);
});
video.addEventListener('pause', (e) => {
console.log(e.type);
});
video.addEventListener('seeking', (e) => {
console.log(e.type);
});
video.addEventListener('seeked', (e) => {
console.log(e.type);
});
video.addEventListener('ended', (e) => {
console.log(e.type);
});
video.addEventListener('durationchange', (e) => {
console.log(e.type, video.duration);
});
video.addEventListener('volumechange', (e) => {
console.log(e.type, video.volume);
});
video.addEventListener('resize', (e) => {
console.log(e.type, video.videoWidth, video.videoHeight);
});
</script>
<br>
<h2>With <a href="https://github.com/muxinc/media-chrome" target="_blank">Media Chrome</a></h2>
<media-controller>
<jwplayer-video
slot="media"
crossorigin
src="https://cdn.jwplayer.com/players/C8YE48zj-IxzuqJ4M.html"
playsinline
>
<track
label="thumbnails"
default
kind="metadata"
src="https://assets-jpcust.jwpsrv.com/strips/C8YE48zj-120.vtt"
/>
</jwplayer-video>
<media-loading-indicator slot="centered-chrome" no-auto-hide></media-loading-indicator>
<media-control-bar>
<media-play-button></media-play-button>
<media-seek-backward-button seek-offset="15"></media-seek-backward-button>
<media-seek-forward-button seek-offset="15"></media-seek-forward-button>
<media-mute-button></media-mute-button>
<media-volume-range></media-volume-range>
<media-time-range></media-time-range>
<media-time-display show-duration remaining></media-time-display>
<media-playback-rate-button></media-playback-rate-button>
<media-pip-button></media-pip-button>
<media-fullscreen-button></media-fullscreen-button>
</media-control-bar>
</media-controller>