fix: add explicit default device option to device selectors #1701
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
As far as we know, there's no reliable way to determine the system's default camera and microphone devices without querying them first-and we shouldn't query the user's media devices unless they're enabled. So we have no way of knowing which camera or microphone device is being used by the browser under the following conditions
Previously, in this case, we simply rendered a list of devices with no device selected. This was confusing and looked "broken".
Now we add an explicit "Default" option to the list instead. This option is purely cosmetic: if it's present, it's always selected, so selecting it does nothing; and if a different device is selected, this option disappears.
Implementation notes
This is implemented on the React SDK level, and the new
useDeviceList
hook is applied to device lists in all device selectors.This hook is public API, documented here: https://github.com/GetStream/docs-content/pull/206