Fix HLS proxy and player functionality (first working version)

This commit is contained in:
Mikhail Yevchenko
2026-04-01 18:21:11 +00:00
parent 198f85b67d
commit 9bbbbc5a65
5 changed files with 681 additions and 303 deletions
+22 -9
View File
@@ -33,21 +33,34 @@
<a href="/" class="back-link">← Back</a>
<h1>{{ title }}</h1>
<div class="video-container">
<video controls>
Your browser does not support HLS.
<video controls id="video">
Your browser does not support video playback.
</video>
</div>
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<script>
const video = document.querySelector('video');
const video = document.getElementById('video');
const hlsUrl = {{ proxy_hls_url | tojson }};
const directUrl = {{ direct_url | tojson }};
if (Hls.isSupported()) {
const hls = new Hls();
hls.loadSource(hlsUrl);
hls.attachMedia(video);
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
video.src = hlsUrl;
if (hlsUrl && hlsUrl !== 'null') {
if (Hls.isSupported()) {
const hls = new Hls();
hls.loadSource(hlsUrl);
hls.attachMedia(video);
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
video.src = hlsUrl;
} else {
loadDirectUrl();
}
} else if (directUrl && directUrl !== 'null') {
loadDirectUrl();
}
function loadDirectUrl() {
if (directUrl && directUrl !== 'null') {
video.src = directUrl;
}
}
</script>
</body>