No specific audio constraints

devicesaudio

This request grants access to all connected audio devices. To optimize quality or select a particular microphone, consider adding explicit audio constraints. This will also prevent selecting unintended devices.

Description

GetUserMedia or GetDisplayMedia API have 2 goals:

  1. Authorizing the browser to access a device
  2. 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).

In this case, there’s a getUserMedia for audio only that has no constraints for the audio.

What do we do here?

We check if there are getUserMedia requests that have the minimal constraints set like {audio: 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