From 99f8ef0ae991e4a67c5ffb9ccc78b592e285f58f Mon Sep 17 00:00:00 2001 From: webadderall <131426131+webadderall@users.noreply.github.com> Date: Mon, 20 Apr 2026 22:29:28 +1000 Subject: [PATCH] fix: don't let webcam teardown block native stop IPC Start webcam stop as a guarded promise so a rejection can't prevent stopNativeScreenRecording from running. The webcam result is awaited only after the native stop path completes. --- src/hooks/useScreenRecorder/recordingStopHelpers.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/hooks/useScreenRecorder/recordingStopHelpers.ts b/src/hooks/useScreenRecorder/recordingStopHelpers.ts index 15b96fe0..a655ee9b 100644 --- a/src/hooks/useScreenRecorder/recordingStopHelpers.ts +++ b/src/hooks/useScreenRecorder/recordingStopHelpers.ts @@ -26,7 +26,10 @@ export async function stopNativeRecordingSession(options: StopRecordingOptions) options.showRecordingFinalizationToast(); const micFallbackBlobPromise = stopMicFallbackRecorder(options.refs); - const webcamPath = await stopWebcamRecorder(options.refs); + const webcamPathPromise = stopWebcamRecorder(options.refs).catch((error) => { + console.warn("Failed to stop webcam recorder:", error); + return null; + }); const isNativeWindows = options.refs.nativeWindowsRecording.current; options.markRecordingResumed(Date.now()); const pauseSegments = options.refs.pauseSegmentsRef.current.slice(); @@ -82,6 +85,7 @@ export async function stopNativeRecordingSession(options: StopRecordingOptions) finalPath = muxResult?.path ?? result.path; } + const webcamPath = await webcamPathPromise; await options.storeMicrophoneSidecar(micFallbackBlobPromise, finalPath); await options.finalizeRecordingSession(finalPath, webcamPath); return true;