Skip to content

Commit

Permalink
Default mic and speaker
Browse files Browse the repository at this point in the history
  • Loading branch information
Sharif Rahaman committed May 6, 2024
1 parent be6b6d9 commit 80ea53b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Project/src/MakeCall/MakeCall.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,8 @@ export default class MakeCall extends React.Component {

try {
const speakers = await this.deviceManager.getSpeakers();
const speakerDevice = speakers[0];
// Select the default or first speaker device found.
const speakerDevice = speakers.find(speaker => speaker.isSystemDefault) ?? speakers[0];
if (!speakerDevice || speakerDevice.id === 'speaker:') {
throw new Error('No speaker devices found.');
} else if (speakerDevice) {
Expand All @@ -434,7 +435,8 @@ export default class MakeCall extends React.Component {

try {
const microphones = await this.deviceManager.getMicrophones();
const microphoneDevice = microphones[0];
// Select the default or first microphone device found.
const microphoneDevice = microphones.find(mic => mic.isSystemDefault) ?? microphones[0];
if (!microphoneDevice || microphoneDevice.id === 'microphone:') {
throw new Error('No microphone devices found.');
} else {
Expand Down

0 comments on commit 80ea53b

Please sign in to comment.