-
Notifications
You must be signed in to change notification settings - Fork 509
fix(media): Fix initial selection of devices #12151
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
Conversation
The lists of preferences are used to select the default input devices when none was selected yet, so they need to be populated first. Otherwise the first time that the devices are updated the lists will be empty, so no default device would be set. Signed-off-by: Daniel Calviño Sánchez <[email protected]>
When no permissions were given yet a single device of each kind with an empty deviceId may be returned (it is in the MediaDevices spec, but implemented by Chromium and not by Firefox yet). Those devices are not registered in the preference lists, so the lists are empty and no default devices are set. Indirectly this causes that no media is requested by the media settings dialog, so no permissions are asked for and thus the list is not updated with the real devices either. Signed-off-by: Daniel Calviño Sánchez <[email protected]>
704ab67 to
6dc4b53
Compare
|
/backport to stable29 |
Antreesy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested against Chrome 124 and Firefox 124, seems to work correctly now in private windows / as logged-in users without permissions granted
|
Thanks for the info :) and it's good to have this fixed before introducing improvements. Based on this PR, first id is now and that's how permissions are requested after. Instead of adding an empty device, what about removing that condition specifically? |
|
and it will only solve the issue for chromium based browsers only. The others will still be left with an empty list, won't be prompted to accept permissions, thus no devices listed eventually. |
If None is explicitly selected ( If audio/videoInputId is
It should work for both Chromium and Firefox (I have not tested Safari, although it should work too 🤞). In the case of Chromium, as it already implements the spec, when no permissions are given there will be a device with an empty id, so In the case of Firefox the list of available devices will be filled with the actual devices, but they will simply use an empty label. Therefore |
Follow up to #12108
@DorraJaouad After being working on this for quite some time I saw that you fixed it several hours ago already 😢
Nevertheless, I took the freedom to push my version anyway as it also handles a special behaviour of Chromium*, and it is a pure fix rather than including an enhancement (showing the devices section when no preferences are set yet). While I think it that is a nice feature I would prefer to see the issue fixed first to then focus on the improvements :-) (specially given that the RC is so close).
*Actually it is in the spec, it is just that Firefox does not implement it yet, but I forgot about it 🤦 Thanks @Antreesy for the digging :-)
How to test
Result with this pull request
The media permissions are requested for and the first available devices selected and started
Result without this pull request
The media permissions are not requested; no devices are selected nor started. Additionally, if the devices tab is shown you first need to choose None and then a device for the permissions to be requested, just selecting the first device (Default in Chromium) is not enough.