Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cover some device selection edge cases #1604

Merged
merged 4 commits into from
Nov 27, 2024

Conversation

myandrienko
Copy link
Contributor

@myandrienko myandrienko commented Nov 27, 2024

This PR fixes some edge cases around device selection:

Selecting the default device

Chrome allows requesting user media with device id default. For the purposes of the SDK, we treat this device as if it didn't existed, and filter it out of device lists. However, it was still possible to select it manually.

Now device id default is filtered out of media requests, so even if it is selected manually, it is replaced with an actual device id when device is unmuted.

Selecting non-existing device id

Previously, selecting non-existing device (e.g. call.camera.select('nonsense')) resulted in the default device being selected. That could be a nasty surprise for a user.

Now, either select method will throw (if device is already unmuted) or enabling the device will throw later.

This takes us to the final change:

Error handler for device selectors

onError callback added to audio and video device selectors, since select method can now throw in a rare case that the device list is stale.

@myandrienko myandrienko marked this pull request as ready for review November 27, 2024 16:15
@myandrienko myandrienko merged commit a8fc0ea into main Nov 27, 2024
15 checks passed
@myandrienko myandrienko deleted the device-selection-edge-cases branch November 27, 2024 16:44
myandrienko added a commit that referenced this pull request Nov 29, 2024
@myandrienko myandrienko mentioned this pull request Nov 29, 2024
myandrienko added a commit that referenced this pull request Nov 29, 2024
This reverts #1604 after reports about not being able to enable
camera/mic.

Also fixes OvercontraintError not being a class on Firefox.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants