Merge pull request #600 from sagar290/webcam-layout-constraints

Fix vertical webcam recording layout
This commit is contained in:
Sid
2026-05-22 19:47:31 -07:00
committed by GitHub
+7 -13
View File
@@ -45,8 +45,6 @@ const AUDIO_BITRATE_VOICE = 128_000;
const AUDIO_BITRATE_SYSTEM = 192_000; const AUDIO_BITRATE_SYSTEM = 192_000;
const MIC_GAIN_BOOST = 1.4; const MIC_GAIN_BOOST = 1.4;
const WEBCAM_TARGET_WIDTH = 1280;
const WEBCAM_TARGET_HEIGHT = 720;
const WEBCAM_TARGET_FRAME_RATE = 30; const WEBCAM_TARGET_FRAME_RATE = 30;
type UseScreenRecorderReturn = { type UseScreenRecorderReturn = {
@@ -268,13 +266,9 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
video: webcamDeviceId video: webcamDeviceId
? { ? {
deviceId: { exact: webcamDeviceId }, deviceId: { exact: webcamDeviceId },
width: { ideal: WEBCAM_TARGET_WIDTH },
height: { ideal: WEBCAM_TARGET_HEIGHT },
frameRate: { ideal: WEBCAM_TARGET_FRAME_RATE, max: WEBCAM_TARGET_FRAME_RATE }, frameRate: { ideal: WEBCAM_TARGET_FRAME_RATE, max: WEBCAM_TARGET_FRAME_RATE },
} }
: { : {
width: { ideal: WEBCAM_TARGET_WIDTH },
height: { ideal: WEBCAM_TARGET_HEIGHT },
frameRate: { ideal: WEBCAM_TARGET_FRAME_RATE, max: WEBCAM_TARGET_FRAME_RATE }, frameRate: { ideal: WEBCAM_TARGET_FRAME_RATE, max: WEBCAM_TARGET_FRAME_RATE },
}, },
}); });
@@ -798,12 +792,12 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
if (availability.reason === "unsupported-os") { if (availability.reason === "unsupported-os") {
return false; return false;
} }
if (availability.reason === "missing-helper") {
console.warn("Native Windows capture helper is not available; using browser capture.");
return false;
}
throw new Error( throw new Error(availability.error ?? "Native Windows capture is not available.");
availability.reason === "missing-helper"
? "Native Windows capture helper is not available."
: (availability.error ?? "Native Windows capture is not available."),
);
} }
if (!isCountdownRunActive(countdownRunToken)) { if (!isCountdownRunActive(countdownRunToken)) {
@@ -858,8 +852,8 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
enabled: webcamEnabled && !browserWebcamRecorder, enabled: webcamEnabled && !browserWebcamRecorder,
deviceId: webcamDeviceId, deviceId: webcamDeviceId,
deviceName: webcamDeviceName, deviceName: webcamDeviceName,
width: WEBCAM_TARGET_WIDTH, width: 0,
height: WEBCAM_TARGET_HEIGHT, height: 0,
fps: WEBCAM_TARGET_FRAME_RATE, fps: WEBCAM_TARGET_FRAME_RATE,
}, },
cursor: { cursor: {