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