fix(windows): address PR 517 review feedback

This commit is contained in:
webadderall
2026-05-17 19:25:01 +10:00
parent 65c832ef1d
commit 1f04674aec
2 changed files with 13 additions and 5 deletions
+1
View File
@@ -55,6 +55,7 @@ public class MonitorHelper {
const result = spawnSync("powershell.exe", ["-NoProfile", "-NonInteractive", "-Command", psScript], {
encoding: "utf-8",
timeout: 5000,
});
if (result.error || result.status !== 0) {
+12 -5
View File
@@ -75,7 +75,6 @@ import {
waitForWindowsCaptureStart,
waitForWindowsCaptureStop,
} from "../recording/windows";
import { getMonitorHandles } from "../monitorResolver";
import {
shouldStartWindowsBrowserMicrophoneFallback,
shouldUseWindowsBrowserMicrophoneFallback,
@@ -439,10 +438,11 @@ export function registerRecordingHandlers(
// Windows Graphics Capture (WGC) requires a raw HMONITOR handle.
// We attempt to resolve the handle by matching the physical coordinates of the target display.
const monitors = getMonitorHandles();
const matchedMonitor = monitors.find(m =>
m.x === Math.round(displayBounds.x) &&
m.y === Math.round(displayBounds.y)
) || monitors[0];
const matchedMonitor = monitors.find(
(monitor) =>
monitor.x === Math.round(displayBounds.x) &&
monitor.y === Math.round(displayBounds.y),
);
if (matchedMonitor) {
config.displayId = matchedMonitor.handle;
@@ -466,6 +466,8 @@ export function registerRecordingHandlers(
config.captureSystemAudio = true;
config.audioOutputPath = tempAudioPath;
setWindowsSystemAudioPath(systemAudioPath);
} else {
setWindowsSystemAudioPath(null);
}
if (options?.capturesMicrophone && !browserMicFallbackRequested) {
@@ -480,6 +482,8 @@ export function registerRecordingHandlers(
} else if (browserMicFallbackRequested) {
config.captureMic = false;
setWindowsMicAudioPath(null);
} else {
setWindowsMicAudioPath(null);
}
recordNativeCaptureDiagnostics({
@@ -574,6 +578,9 @@ export function registerRecordingHandlers(
setNativeScreenRecordingActive(false);
setWindowsCaptureProcess(null);
setWindowsCaptureTargetPath(null);
setWindowsSystemAudioPath(null);
setWindowsMicAudioPath(null);
setWindowsOrphanedMicAudioPath(null);
setWindowsCaptureStopRequested(false);
setWindowsCapturePaused(false);
return {