Preview Camera - no error thrown when camera already in use or system permissions denied

Description
In Chrome, the preview camera feature is NOT throwing an error, when the camera is already in use by another app (or) if camera permission is denied to the browser by the host OS settings.

Accessing camera in actual calls throw an error successfully for the above mentioned situations, but the preview doesn’t throw an error.

Throwing an error will allow us to catch it and show appropriate error message to the user, but as of now there is no way to alert the user as no error is thrown by the web VideoSDK for preview camera.

Which Web Video SDK version?
2.1.0

Video SDK Code Snippets

// Actual Video Calls

try {
  await stream.startVideo();
} catch (e) {
  // handle error
  // error received if camera is already in use (or)
  // if camera system level permissions denied
}
// Preview Camera

try {
  const localTrack = ZoomVideo.createLocalVideoTrack(camera.deviceId);

  await localTrack.start(document.querySelector("#local-preview-video"));
  // (OR)
  await localTrack.switchCamera(camera.deviceId);

} catch (e) {
  // NO error received if camera is already in use (or)
  // if camera system level permissions denied
}

Additional context
Throwing the right error will help us to show appropriate error message or next steps to the user.

Please note, the above behavior is in Chrome. Also, while the happy paths work fine, the error case scenarios show different behavior/error messages for different browsers (Chrome vs Firefox).

  1. Can we have preview camera to throw appropriate errors on error scenarios same as of actual video calls?
  2. Is there any way to throw consistent error messages for all browsers?

Hi @James_Ashok I can help take a look at this for you. Let me check in my environment and I’ll get back to you shortly with an update!

Hey @James_Ashok

Thanks for your feedback.

It’s indeed an issue, and we will fix it in the next release.

Thanks
Vic

1 Like

Hi @vic.yang

We’ve been having the same issue where the preview camera does not start and is not throwing an error on chrome. The error of ‘permissions denied’ looks to be resolved but I believe in other cases, it still does not throw the error.

We have reports of this issue multiple times a week and randomly experience this ourselves in testing. When this happens, refreshing fixes the video preview, but we would like to have error handling functionality. We are on web videosdk version 2.3.0. Thanks in advance for your help

Hey @David30

Thanks for your feedback.

I’d like to understand further: when you use localVideoTrack for preview, which element are you using? a video player, a video element, or a canvas element?

Thanks
Vic

We are using video-player within a video-player-container

Hi @David30

We are using video-player within a video-player-container

Thank you for the information. We will add handling for video capture errors caused by more scenarios in the next release.

Thanks
Vic

1 Like

Hi @vic.yang,

Thank you for the update. I was wondering if you had the list of specific video capture errors that may be leading to this issue. It would be helpful to note the extent of the issue pending the next release.

Thanks,

David

Hi @David30

After analysis, we believe a possible cause is similar to the video exceptions in the active-media-failed event. However, since the user is not yet in session, this event is not triggered.

We will improve the relevant exceptions in the local video track.

https://developers.zoom.us/docs/video-sdk/web/handle-events/#video-exceptions

Thanks
Vic

1 Like