fix(capture): stabilize platform source handling

This commit is contained in:
wiiiii123
2026-05-26 23:12:01 +07:00
parent 73bd4f11f5
commit 31d1022fef
6 changed files with 167 additions and 19 deletions
+7 -2
View File
@@ -211,6 +211,12 @@ export function resolveBrowserCaptureCursorPolicy({
};
}
export function shouldUseNativeWindowsCaptureForSource(
source: Pick<ProcessedDesktopSource, "id"> | null | undefined,
): boolean {
return source?.id?.startsWith("screen:") === true;
}
export function createProcessedMicrophoneConstraints(
microphoneDeviceId?: string,
profile: BrowserMicrophoneProfile = DEFAULT_BROWSER_MICROPHONE_PROFILE,
@@ -1362,8 +1368,7 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
let nativeWindowsCaptureStartFailed = false;
if (
platform === "win32" &&
(selectedSource.id?.startsWith("screen:") ||
selectedSource.id?.startsWith("window:")) &&
shouldUseNativeWindowsCaptureForSource(selectedSource) &&
typeof window.electronAPI.isNativeWindowsCaptureAvailable === "function"
) {
try {