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).
- Can we have preview camera to throw appropriate errors on error scenarios same as of actual video calls?
- Is there any way to throw consistent error messages for all browsers?