fix pause error

This commit is contained in:
2026-10-04 08:48:32 -04:00
parent dd63da30c4
commit 44bf21a868

View File

@@ -766,7 +766,10 @@ function CameraDemo() {
createEffect(() => { createEffect(() => {
if (phase() === "live" && videoRef) { if (phase() === "live" && videoRef) {
videoRef.currentTime = 0; videoRef.currentTime = 0;
videoRef.play(); // play() rejects with AbortError when interrupted by pause() (the loop
// resetting to "idle") or when the browser pauses background media to
// save power. Swallow it — the rejection is expected, not a failure.
void videoRef.play().catch(() => {});
} else { } else {
videoRef?.pause(); videoRef?.pause();
} }