mirror of
https://github.com/webadderallorg/Recordly.git
synced 2026-09-25 07:16:02 +00:00
Address CodeRabbit microphone follow-ups
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user