No specific audio and video constraints
This request grants access to all connected audio and video devices. To optimize quality or select a particular microphone and webcam, consider adding explicit audio and video constraints. This will also prevent selecting unintended devices.
Description
GetUserMedia or GetDisplayMedia API have 2 goals:
- Authorizing the browser to access a device
- Get the stream from this device
When no constraint is set it could lead to selecting the wrong device (eg: virtual or system default) which might not be the one the user wants. Not adding constraints allows getting a different level of quality, depending on the device or browser default settings (such as mono or stereo for a microphone).
What do we do here?
We check if there are getUserMedia requests that have the minimal constraints set like {audio:true, video: true} or {audio: true} or {video: true} except and by discarding the first request done for a domain.
Notes
The first getUserMedia for a domain is discarded in this check because it is mainly used to authorize the devices for enumerating the devices and collecting the device labels.
Our suggestions
- Consider adding constraints to your calls for getUserMedia