-
Notifications
You must be signed in to change notification settings - Fork 64
Description
Currently, to get a media device list we must first make a call to getUserMedia(). This creates UX headaches for use cases where the user needs to pick a device first, and capture from it second. The current flow looks like this:
- Application awaits
getUserMedia()before callingenumerateDevices(). - User is confused about why the application is requesting a camera and/or microphone, and hopefully approves the request.
- Application receives the stream from
getUserMedia(). - Application stops all tracks.
- Application proceeds with
enumerateDevices(), and shows the user a selection of devices to choose from. - User chooses what they want.
- Application makes final call to
getUserMedia()to get the stream.
What would be more desirable:
- Application awaits
enumerateDevices(). - User is prompted to approve access to cameras and/or microphones, and hopefully approves.
- Application shows a user a selection of devices to choose from.
- User chooses what they want.
- Application calls
getUserMedia()and gets a stream, without requiring additional approval from the user.
In other words, if the browsing context doesn't yet have audio/video capture permission before calling enumerateDevices(), that permission should be requested before enumerateDevices() resolves. And, the same permission gate for getUserMedia() should be used, so that if/when we eventually do call getUserMedia(), it's already been approved.
enumerateDevices() is already promise-based, so this seems mostly compatible with existing APIs.
Ideally, enumerateDevices() would also contain a filter option (#522) so that if an application only needed audio or video permission, they could request just what is needed.
This type of flow is important, particularly for applications where several tracks are used simultaneously. I understand in the past that there was a desire to have the user agent control device selection, but this is not a good user experience for anything outside of the a basic single-stream video conferencing application.