From 3a0b3fca9e38014551468cfe08eae7184a431c61 Mon Sep 17 00:00:00 2001 From: Azeem Tariq Date: Mon, 30 Mar 2026 15:47:13 +0500 Subject: [PATCH] fix(recording): preserve mic audio when recovering mac capture --- electron/ipc/handlers.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/electron/ipc/handlers.ts b/electron/ipc/handlers.ts index 0b030be7..9957465c 100644 --- a/electron/ipc/handlers.ts +++ b/electron/ipc/handlers.ts @@ -2651,25 +2651,32 @@ async function finalizeStoredVideo(videoPath: string) { } async function recoverNativeMacCaptureOutput() { - const diagnosticsPath = + const macDiagnostics = lastNativeCaptureDiagnostics?.backend === 'mac-screencapturekit' - ? lastNativeCaptureDiagnostics.outputPath ?? null + ? lastNativeCaptureDiagnostics : null + const diagnosticsPath = macDiagnostics?.outputPath ?? null const candidatePath = nativeCaptureTargetPath ?? diagnosticsPath + const systemAudioPath = nativeCaptureSystemAudioPath ?? macDiagnostics?.systemAudioPath ?? null + const microphonePath = nativeCaptureMicrophonePath ?? macDiagnostics?.microphonePath ?? null if (!candidatePath) { return null } try { + if (systemAudioPath || microphonePath) { + await muxNativeMacRecordingWithAudio(candidatePath, systemAudioPath, microphonePath) + } + return await finalizeStoredVideo(candidatePath) } catch (error) { recordNativeCaptureDiagnostics({ backend: 'mac-screencapturekit', phase: 'stop', outputPath: candidatePath, - systemAudioPath: nativeCaptureSystemAudioPath, - microphonePath: nativeCaptureMicrophonePath, + systemAudioPath, + microphonePath, processOutput: nativeCaptureOutputBuffer.trim() || undefined, fileSizeBytes: await getFileSizeIfPresent(candidatePath), error: String(error), @@ -4899,4 +4906,3 @@ body{background:transparent;overflow:hidden;width:100vw;height:100vh} } }) } -