The MediaStreamError exception is a collection of exceptions related to problems with accessing the local media (microphone and camera). The MediaStreamError exception includes a name property, which provides more information about the error. MediaStreamError includes the following names:

  • NotAllowedError: Occurs when the user has not granted access to media devices (microphone, camera, and screen share).
    To resolve this problem, refer to the browser-specific instructions for enabling access to the media devices when the application is loaded into the browser. You should see a one-time pop-up window requesting the user to grant access to media devices. Users can use the settings menu to change the settings later.

  • OverconstrainedError: Occurs when none of the user's media devices match the media constraints specified by the application. For example, the application requires 1920x1080 as a minimum resolution for the video capture device but the user only has a camera that supports 720p.
    For more details, refer to the exception name and messages related to this error.
    To resolve this problem, do not make the media constraints too restrictive when calling getUserMedia. If the application requires strict media constraints, report this error to the users notifying them that the media devices are not compatible with the application.

  • NotFoundError: Occurs when there are no media tracks of the type specified for getUserMedia that satisfy the given constraints. For example, this error occurs when an application tries to call getUserMedia with the “video" media type on a computer that does not have a camera.

  • AbortError: Occurs when the device is not working even though the user and the operating system have access to the hardware device, and there are no hardware issues causing NotReadableError.

  • NotReadableError: Occurs when a device is not working even though the user has granted permission to use the matching device. This exception may be caused by a hardware error at the level of the operating system, browser, or web page.

  • SecurityError: Occurs when the user media support is disabled on the document on which getUserMedia() was called. The mechanism by which user media support is enabled and disabled is left up to the individual user agent.

  • TypeError: Occurs when a list of specified constraints is empty or when all constraints are set to false. This exception can also happen if you try to call getUserMedia() in an insecure context.