-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
38 lines (38 loc) · 1.16 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
<!DOCTYPE html>
<html>
<head>
<title>HLS Player</title>
</head>
<body>
<h1>HIGH COURT OF DELHI</h1>
<video id="player" controls></video>
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<script>
// Set up HLS player with auto reconnect
var player = document.getElementById('player');
if (Hls.isSupported()) {
var hls = new Hls();
hls.loadSource('https://example.com/stream.m3u8');
hls.attachMedia(player);
hls.on(Hls.Events.ERROR, function(event, data) {
if (data.fatal) {
switch(data.type) {
case Hls.ErrorTypes.NETWORK_ERROR:
console.log("Fatal network error encountered, try to recover");
hls.startLoad();
break;
case Hls.ErrorTypes.MEDIA_ERROR:
console.log("Fatal media error encountered, try to recover");
hls.recoverMediaError();
break;
default:
console.log("Unknown error type");
hls.destroy();
break;
}
}
});
}
</script>
</body>
</html>