feat: add error handling to player core functions

This commit is contained in:
2026-06-16 14:00:38 +02:00
committed by Milas Holsting
parent 3a1a2129d9
commit 2a8294c405
9 changed files with 45 additions and 22 deletions

View File

@@ -26,7 +26,8 @@ const shouldUseHLS = (type: string | undefined, url: string): boolean => {
const parsed = new URL(url, window.location.href);
if (parsed.searchParams.get("hls") === "1") return true;
return parsed.pathname.toLowerCase().endsWith(".m3u8");
} catch {
} catch (error) {
console.error("Failed to parse video URL:", error);
return url.toLowerCase().includes(".m3u8");
}
};
@@ -65,6 +66,8 @@ export const loadVideoSource = (url: string, type?: string): void => {
}
if (wasPlaying) {
state.elements.video.play().catch(() => undefined);
state.elements.video.play().catch((error) => {
console.debug("failed to play video:", error);
});
}
};