forked from Mike/freno-dev
fix pause error
This commit is contained in:
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user