Skip to content

Commit

Permalink
Merge pull request #227 from sharifrahaman/default-microphone-and-spe…
Browse files Browse the repository at this point in the history
…aker

Use default mic and speaker to make call
  • Loading branch information
sharifrahaman authored May 6, 2024
2 parents be6b6d9 + 80ea53b commit d99427b
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 d99427b

Please sign in to comment.