Address CodeRabbit microphone follow-ups

This commit is contained in:
webadderall
2026-06-01 20:28:04 +10:00
parent b92453a46c
commit 474ca5a180
2 changed files with 9 additions and 5 deletions
+5 -1
View File
@@ -72,9 +72,13 @@ export function useMicrophoneDevices(enabled: boolean = true, preferredDeviceId?
let allDevices = await navigator.mediaDevices.enumerateDevices();
let audioInputs = getAvailableMicrophoneDevices(allDevices);
const rawAudioInputs = allDevices.filter(
(device): device is MediaDeviceInfo => device.kind === "audioinput",
);
const needsLabelPermission =
audioInputs.length > 0 && audioInputs.every((device) => !device.label.trim());
rawAudioInputs.length > 0 &&
rawAudioInputs.every((device) => !device.label.trim());
if (needsLabelPermission && !hasRequestedMicrophoneLabels) {
hasRequestedMicrophoneLabels = true;
+4 -4
View File
@@ -1520,7 +1520,7 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
if (useNativeMacScreenCapture || useNativeWindowsCapture) {
// Resolve the selected mic label for native capture backends.
let micLabel: string | undefined;
let nativeMicrophoneDeviceId = microphoneDeviceId;
let resolvedMicrophoneDeviceId = microphoneDeviceId;
if (microphoneEnabled) {
try {
const devices = await navigator.mediaDevices.enumerateDevices();
@@ -1528,7 +1528,7 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
const mic = availableMicrophones.find(
(device) => device.deviceId === microphoneDeviceId,
);
nativeMicrophoneDeviceId = mic?.deviceId;
resolvedMicrophoneDeviceId = mic?.deviceId;
micLabel = mic?.label || undefined;
} catch {
// Fall through — native process will use the default mic
@@ -1540,7 +1540,7 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
{
capturesSystemAudio: systemAudioEnabled,
capturesMicrophone: microphoneEnabled,
microphoneDeviceId: nativeMicrophoneDeviceId,
microphoneDeviceId: resolvedMicrophoneDeviceId,
microphoneLabel: micLabel,
},
);
@@ -1591,7 +1591,7 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
console.info("Using browser microphone processing for this recording.");
try {
const microphoneConstraints = createProcessedMicrophoneConstraints(
microphoneDeviceId,
resolvedMicrophoneDeviceId,
browserMicrophoneProfile.current,
);
micFallbackRequestedConstraints.current = microphoneConstraints;