-
Notifications
You must be signed in to change notification settings - Fork 432
/
index.html
33 lines (32 loc) · 904 Bytes
/
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
<html>
<link rel="shortcut icon" href="about:blank"/>
<style>
h3 { text-align: center }
video { display: block; margin: 0 auto }
</style>
<body>
<!--fill streamList variable with the list of streams -->
<script src="getStreamList?streamList" ></script>
<h3>HLS</h3>
<div id="videos"></div>
<script src="hls.js" ></script>
<script>
if (Hls.isSupported()) {
var videos = document.getElementById("videos")
streamList.forEach( (stream) => {
var title = document.createElement("h3");
title.innerText = stream
videos.appendChild(title)
var video = document.createElement("video");
videos.appendChild(video)
var hls = new Hls();
hls.loadSource(stream+".m3u8");
hls.attachMedia(video);
hls.on(Hls.Events.MANIFEST_PARSED, function() { video.play(); });
})
} else {
alert("HLS not supported");
}
</script>
</body>
</html>