Web autoplay and device access
This article will help you to understand the autoplay policy in web browsers and device errors.
Autoplay policies in browsers
Most popular browsers, including Chrome and Safari, can prevent media autoplay by default. In some browsers, including Safari, users can manage the settings to allow or restrict media autoplay for separate websites.
For this reason, web developers should not assume that video playback in browsers starts automatically, including video chats and conferences. If users do not have any video playback settings stored in their browser, you need to render a play button manually to start the video.
Some browsers, including Chrome, use the Media Engagement Index to measure a user's propensity to play video on a site. The browsers estimate significant MEI based on the following points:
The tab with the video is active.
The size of the video (in px) is greater than 200x140.
Media playback is greater than 7 seconds
Audio track is present and unmuted.
Based on the MEI, the browser allows video autoplay for sites with higher scores.
If a user has blocked video playback in the browser settings, the video chat does not start and the PlaybackError event occurs.
Microphone and camera access errors
To start a call or a conference, a user needs to grant permission to access the microphone and camera. That is why, when you initialize the SDK or use the call and callConference functions, the browser asks for permission to use the devices.
In the Web SDK, a user can not join a video chat or a conference without granting access to the microphone. If a user declines the microphone prompt, the call fails with the Call.Failed event.
Commonly, a browser requests the microphone and camera permission in one dialog. If a user declines it, the SDK requests the microphone only access. A user can still access the video call or conference with microphone only access.
How to troubleshoot device access errors
To track the user’s response to the permission request, subscribe to the MicAccessResult event. When access is granted, it returns true, when it is denied, it returns false.
To track the device errors and exceptions, use the developer console.
Here are the most common exceptions:
AbortError | The user has granted access to the device, and no hardware issues occurred that would cause a NotReadableError, some problem occurred which prevented the device from being used. Most commonly, this happens due to the browser's autoplay policy. |
NotAllowedError | The user has been denied access to the webcam or microphone. |
NotFoundError | The user does not have a camera/microphone, the driver is not installed or the device is disabled in OS settings. |
NotReadableError | Windows or iOS tries to access the camera/microphone which is already in use by another process, such as Zoom or another application |
OverconstrainedError | The requested video constraint or audio constraint cannot be satisfied by the available hardware. For example, high video frame rate or high video resolution. |
PermissionDismissedError | The user has closed the Google Chrome permission request dialog asking for microphone and webcam access. |