/
index.html
100 lines (84 loc) · 2.64 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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>MPEG2-TS Video Element</title>
<script type="module" src="https://cdn.jsdelivr.net/npm/media-chrome@1/+esm"></script>
<script type="module" src="/src/main.ts"></script>
<style>
html,
body {
box-sizing: border-box;
margin: 0;
padding: 0;
display: flex;
width: 100%;
}
media-live-button {
display: none;
}
media-controller {
aspect-ratio: 16/9;
width: 80%;
margin: 20px;
border-radius: 10px;
overflow: hidden;
}
media-controller[mediastreamtype='live'] media-time-range {
display: none;
}
media-controller[mediastreamtype='live'] media-live-button {
display: block;
}
media-controller[mediastreamtype='live'] .spacer {
background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / 0.7)));
flex-grow: 1;
}
media-controller[userinactive]:not([mediapaused]) {
cursor: none;
}
media-controller [slot='media'][controls]~media-control-bar {
display: none;
}
</style>
</head>
<body>
<media-controller noautoseektolive defaultstreamtype="live" liveedgeoffset="30">
<mpegts-video slot="media" muted autoplay src="http://81.94.196.204/tsstreamer/France24_HD.ts" preload="metadata"
defer></mpegts-video>
<media-loading-indicator slot="centered-chrome" noautohide></media-loading-indicator>
<media-control-bar>
<media-play-button></media-play-button>
<media-mute-button></media-mute-button>
<media-volume-range></media-volume-range>
<media-time-range></media-time-range>
<span class="spacer"></span>
<media-pip-button></media-pip-button>
<media-captions-button></media-captions-button>
<media-live-button disabled></media-live-button>
<media-fullscreen-button></media-fullscreen-button>
</media-control-bar>
</media-controller>
<script>
customElements.whenDefined('mpegts-video').then(() => {
const video = document.querySelector('mpegts-video');
// set a custom mpegts config
video.mpegtsConfig = {
lazyLoadMaxDuration: 3 * 60,
enableWorker: true,
reuseRedirectedURL: true,
};
//set a custom mpegts logging config
video.mpegtsLoggingConfig = {
forceGlobalTag: true,
globalTag: 'mpegts-video-element',
enableVerbose: true,
};
// then load the player
video.load();
});
</script>
</body>
</html>