init
This commit is contained in:
35
public/index.html
Normal file
35
public/index.html
Normal file
@ -0,0 +1,35 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>HLS Video Přehrávač</h1>
|
||||
<video id="video" controls width="600" height="400"></video>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
const video = document.getElementById("video");
|
||||
const hls = new Hls({
|
||||
drm: {},
|
||||
});
|
||||
|
||||
const videoSrc = "/videos/" + window.location.search.replace("?", "");
|
||||
|
||||
if (Hls.isSupported()) {
|
||||
hls.loadSource(videoSrc);
|
||||
hls.attachMedia(video);
|
||||
hls.on(Hls.Events.MANIFEST_PARSED, () => {
|
||||
video.play();
|
||||
});
|
||||
} else if (video.canPlayType("application/vnd.apple.mpegurl")) {
|
||||
video.src = videoSrc;
|
||||
video.addEventListener("loadedmetadata", () => {
|
||||
video.play();
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user