diff --git a/public/js/app_player.js b/public/js/app_player.js index 35b0cea..4ffbadd 100644 --- a/public/js/app_player.js +++ b/public/js/app_player.js @@ -582,10 +582,10 @@ async function probeApiVideoReadable(rawUrl) { async function ensurePlayableApiVideoUrl(rawUrl, token) { if (!isApiVideoUrl(rawUrl) || !token) return rawUrl; - await ensureVideoSessionForSource(rawUrl, token); - const ok = await probeApiVideoReadable(rawUrl); - if (ok) return rawUrl; - // Fallback: servers also accept ?token=... (avoids cookie timing/site issues). + // IMPORTANT: Prefer query-token auth for media elements. + // Cookie-based auth is unreliable cross-origin (and even across ports in some setups) + // and causes intermittent 401s + preflight noise. Both Node + Python servers already + // support ?token=... so we use it consistently. return addTokenToApiVideoUrl(rawUrl, token); } @@ -625,7 +625,7 @@ async function playVodLink(vodLink, { token } = {}) { videoEl.addEventListener('error', () => { // If the browser can't play it (or CORS blocks), fall back to iframe. setSourceLabel('Embed (fallback)'); - showEmbedPlayer(raw); + showEmbedPlayer(playable); }, { once: true }); try { videoEl.load(); } catch (_) {} return; @@ -782,9 +782,7 @@ window.onload = async function () { return; } - // Allow