improved video play

This commit is contained in:
Simon
2026-02-08 20:44:36 +00:00
parent 407e3bf9c6
commit 6915da7f85
2 changed files with 71 additions and 19 deletions

View File

@@ -240,7 +240,14 @@ async function openPlayer(url) {
const video = document.getElementById('player');
// 1. Define isHls (the missing piece!)
const streamUrl = `/api/stream?url=${encodeURIComponent(url)}`;
let refererParam = '';
try {
const origin = new URL(url).origin;
refererParam = `&referer=${encodeURIComponent(origin + '/')}`;
} catch (err) {
refererParam = '';
}
const streamUrl = `/api/stream?url=${encodeURIComponent(url)}${refererParam}`;
let isHls = /\.m3u8($|\?)/i.test(url);
// 2. Cleanup existing player instance to prevent aborted bindings