Skip to content

Commit d9b33dd

Browse files
authored
Fix the issue that the device is not selected in Firefox (#541)
1 parent 7012726 commit d9b33dd

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/providers/MeetingProvider/MeetingManager.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -344,15 +344,9 @@ export class MeetingManager implements AudioVideoObserver {
344344
async listAndSelectDevices(): Promise<void> {
345345
await this.updateDeviceLists();
346346

347-
let hasAudioInput = false, hasAudioOutput = false, hasVideoInput = false;
348-
const devices = await navigator.mediaDevices.enumerateDevices();
349-
for (const device of devices) {
350-
if (device.label) {
351-
if (device.kind === "audioinput") hasAudioInput = true;
352-
if (device.kind === "audiooutput") hasAudioOutput = true;
353-
if (device.kind === "videoinput") hasVideoInput = true;
354-
}
355-
}
347+
const hasAudioInput = this.audioInputDevices?.some(value => value.label) || false;
348+
const hasAudioOutput = this.audioOutputDevices?.some(value => value.label) || false;
349+
const hasVideoInput = this.videoInputDevices?.some(value => value.label) || false;
356350

357351
if (
358352
hasAudioInput &&

0 commit comments

Comments
 (0)