Skip to content

Commit

Permalink
fix: add catch block for getUserMedia
Browse files Browse the repository at this point in the history
  • Loading branch information
khushal87 committed Sep 27, 2023
1 parent f32bf9e commit b690331
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions packages/client/src/devices/devices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,19 @@ const getDevices = (constraints?: MediaStreamConstraints) => {
// in Firefox, devices can be enumerated after userMedia is requested
// and permissions granted. Otherwise, device labels are empty
if (isFirefox()) {
navigator.mediaDevices.getUserMedia(constraints).then((media) => {
enumerateDevices(media);
});
navigator.mediaDevices
.getUserMedia(constraints)
.then((media) => {
enumerateDevices(media);
})
.catch((error) => {
getLogger(['getUserMedia'])(
'error',
'Failed to get user media on firefox',
error,
);
subscriber.error(error);
});
} else {
enumerateDevices();
}
Expand Down

0 comments on commit b690331

Please sign in to comment.