refactor: share stream url

This commit is contained in:
2026-06-01 22:26:57 +02:00
parent 455490f07d
commit 55bf11d8be
3 changed files with 15 additions and 18 deletions

13
static/player/source.ts Normal file
View File

@@ -0,0 +1,13 @@
import { state } from "./state";
export const streamUrlForMode = (mode: string, quality?: string): string => {
const src = state.modeSources[mode];
if (!src?.token) return "";
let url = `${state.streamURL}?mode=${encodeURIComponent(mode)}&token=${encodeURIComponent(src.token)}`;
if (quality && quality !== "best") {
url += `&quality=${encodeURIComponent(quality)}`;
}
return url;
};