miruro / lib /constants.ts
mwask's picture
Upload 45 files
3e8e34c verified
Raw
History Blame Contribute Delete
368 Bytes
export type StreamKind = "hls" | "dash" | "native";
/** Detect the streaming engine to use from a source URL. */
export function detectStreamKind(src: string): StreamKind {
const path = src.split("?")[0].toLowerCase();
if (path.endsWith(".m3u8")) return "hls";
if (path.endsWith(".mpd")) return "dash";
return "native"; // mp4, webm, ogg, mov, …
}