Merge remote-tracking branch 'origin/main' into codex/fix-windows-paused-recording

# Conflicts:
#	src/hooks/useScreenRecorder.ts
This commit is contained in:
Siddharth
2026-05-22 20:08:26 -07:00
17 changed files with 813 additions and 142 deletions
+26 -1
View File
@@ -230,6 +230,7 @@ const outputPath = path.join(
os.tmpdir(),
`openscreen-wgc-helper-${WITH_WEBCAM ? "webcam" : WITH_WINDOW ? "window" : WITH_SYSTEM_AUDIO || WITH_MICROPHONE ? "audio" : "video"}-${process.pid}-${Date.now()}-${randomUUID()}.mp4`,
);
const webcamOutputPath = WITH_WEBCAM ? outputPath.replace(/\.mp4$/i, "-webcam.mp4") : null;
const fixtureWindow = WITH_WINDOW ? await startFixtureWindow() : null;
@@ -263,7 +264,10 @@ const config = {
webcamWidth: 640,
webcamHeight: 360,
webcamFps: 30,
outputs: { screenPath: outputPath },
outputs: {
screenPath: outputPath,
...(webcamOutputPath ? { webcamPath: webcamOutputPath } : {}),
},
};
let result;
@@ -289,8 +293,13 @@ if (result.code !== 0) {
if (!fs.existsSync(outputPath) || fs.statSync(outputPath).size === 0) {
throw new Error(`WGC helper did not produce a video at ${outputPath}`);
}
if (WITH_WEBCAM && (!fs.existsSync(webcamOutputPath) || fs.statSync(webcamOutputPath).size === 0)) {
throw new Error(`WGC helper did not produce a webcam video at ${webcamOutputPath}`);
}
const streams = probeStreams(outputPath);
const webcamStreams =
webcamOutputPath && fs.existsSync(webcamOutputPath) ? probeStreams(webcamOutputPath) : [];
const hasVideo = streams.some((stream) => stream.codec_type === "video");
const hasAudio = streams.some((stream) => stream.codec_type === "audio");
const webcamFormatLine = result.stdout
@@ -318,6 +327,9 @@ const nativeMicrophoneDiagnostics = result.stderr
if (!hasVideo) {
throw new Error(`WGC helper output has no video stream: ${outputPath}`);
}
if (WITH_WEBCAM && !webcamStreams.some((stream) => stream.codec_type === "video")) {
throw new Error(`WGC helper webcam output has no video stream: ${webcamOutputPath}`);
}
if (
(CAPTURE_CURSOR && !cursorCapture) ||
(cursorCapture &&
@@ -342,13 +354,26 @@ console.log(
{
success: true,
outputPath,
webcamOutputPath,
bytes: fs.statSync(outputPath).size,
webcamBytes:
webcamOutputPath && fs.existsSync(webcamOutputPath)
? fs.statSync(webcamOutputPath).size
: undefined,
streams: streams.map((stream) => ({
index: stream.index,
codecType: stream.codec_type,
codecName: stream.codec_name,
duration: stream.duration,
})),
webcamStreams: webcamStreams.map((stream) => ({
index: stream.index,
codecType: stream.codec_type,
codecName: stream.codec_name,
width: stream.width,
height: stream.height,
duration: stream.duration,
})),
cursorCapture,
selectedMicrophoneDeviceName: audioFormat?.microphoneDeviceName,
selectedWebcamDeviceName: webcamFormat?.deviceName,