48 lines
1.1 KiB
HTML
48 lines
1.1 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
<title>Video Player</title>
|
|
<style>
|
|
#vidPlayer {
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
bottom: 0;
|
|
right: 0;
|
|
overflow: auto;
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<video id="vidPlayer" controls></video>
|
|
|
|
<script src="hls.light.min.js"></script>
|
|
<script>
|
|
const vidPlayer = document.querySelector('#vidPlayer');
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
const url = `https://vdo.mwit.ac.th/live/${urlParams.get('channel')}/playlist.m3u8`;
|
|
|
|
if (
|
|
!/Android|webOS|iPhone|iPad|iPod|Edge|iOS/i.test(navigator.userAgent) &&
|
|
Hls.isSupported()
|
|
) {
|
|
hls = new Hls();
|
|
hls.loadSource(url);
|
|
hls.attachMedia(vidPlayer);
|
|
hls.on(Hls.Events.MANIFEST_PARSED, vidPlayer.play);
|
|
}
|
|
else {
|
|
vidPlayer.src = url;
|
|
vidPlayer.play();
|
|
}
|
|
</script>
|
|
</body>
|
|
|
|
</html>
|