Files
openscreen/src/lib/nativeWindowsRecording.ts
T
2026-05-10 15:11:21 +02:00

57 lines
1022 B
TypeScript

export type NativeWindowsSourceType = "display" | "window";
export type NativeWindowsRecordingRequest = {
recordingId?: number;
source: {
type: NativeWindowsSourceType;
sourceId: string;
displayId?: number;
windowHandle?: string;
};
video: {
fps: number;
width: number;
height: number;
};
audio: {
system: {
enabled: boolean;
};
microphone: {
enabled: boolean;
deviceId?: string;
gain: number;
};
};
webcam: {
enabled: boolean;
deviceId?: string;
deviceName?: string;
directShowClsid?: string;
width: number;
height: number;
fps: number;
};
};
export type NativeWindowsRecordingStartResult = {
success: boolean;
recordingId?: number;
path?: string;
helperPath?: string;
error?: string;
};
export function parseWindowHandleFromSourceId(sourceId?: string | null) {
if (!sourceId?.startsWith("window:")) {
return null;
}
const handlePart = sourceId.split(":")[1];
if (!handlePart || !/^\d+$/.test(handlePart)) {
return null;
}
return handlePart;
}