Skip to content

Commit 050f1dc

Browse files
authored
chore: Ensure device provider lists have at least one listed device (RocketChat#36983)
1 parent c5d4879 commit 050f1dc

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

apps/meteor/client/providers/DeviceProvider/DeviceProvider.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,12 @@ export const DeviceProvider = ({ children }: DeviceProviderProps): ReactElement
7070
type: device.kind,
7171
}));
7272

73-
const audioInput = mappedDevices.filter((device) => device.type === 'audioinput');
73+
const filteredInput = mappedDevices.filter((device) => device.type === 'audioinput');
7474

75-
const audioOutput = mappedDevices.filter((device) => device.type === 'audiooutput');
75+
const filteredOutput = mappedDevices.filter((device) => device.type === 'audiooutput');
76+
77+
const audioInput = filteredInput.length > 0 ? filteredInput : [defaultDevices.defaultAudioInputDevice];
78+
const audioOutput = filteredOutput.length > 0 ? filteredOutput : [defaultDevices.defaultAudioOutputDevice];
7679

7780
return {
7881
audioInput,

0 commit comments

Comments
 (0)