-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: various device selector issues (#1541)
This PR fixes a bunch of device selector issues. ## Invalid default device indicator In some of our device selector components, we assumed that the first device in the list was the default. This isn't always true. So now, if we don't know what the default device is, we don't mark any device as selected, which is more "honest" behavior. ![image](https://github.com/user-attachments/assets/ae815782-5950-4845-a338-95cabc9d35d5) This PR also ensures that device selectors always fall back to the "Default" option if the current device is not found in the device list (e.g. because of stale persisted device preferences) or the device list is empty (e.g. if there's no browser permission). ![image](https://github.com/user-attachments/assets/05c132fa-d581-4ca8-964d-476c22d60b0c) ![image](https://github.com/user-attachments/assets/ca36a120-e178-4531-bb5e-a487be7bb1ba) ## Older Firefox cannot query permissions Up until version 131 (incl.) there was no way to query camera and microphone permissions with `navigator.permissions.query`. We now assume that permission status is `prompt` in this case, and just try getting user media. If it works, permission is granted, if not - it’s denied. ## Firefox doesn't show device labels without `getUserMedia` When enumerating devices, Firefox will hide device labels unless there’s been an active user media stream on the page. So even when camera and microphone permissions are `granted`, device labels are still hidden until there’s been a successful call to `getUserMedia`. Now we force device list updates after every successful `getUserMedia` call. ## Safari doesn't fire permission change events reliably Safari doesn't fire camera and microphone permission change events for reliably. For example, the event doesn't fire if the user denies camera/microphone access in the initial prompt. As a result, we didn't reliably display missing permission indicators in Safari. We now update browser permission state not only from permission change events, but also based on `NotAllowedError` and successful attempts to obtain the user's media stream.
- Loading branch information
1 parent
84d49b3
commit f23618b
Showing
4 changed files
with
38 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters