secure_video_share/public/index.html
2024-07-31 13:37:56 +02:00

36 lines
1.0 KiB
HTML

<!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>