Mobile Browser LocalVideoTrack.SwitchCamera Reesulting to Black Preview

Video SDK Type and Version zoom/videosdk 2.1.0

Description

Switching camera for the first time in mobile browsers resulting to black preview video but subsequent switching works as expected. No such problem for desktop browsers

Error?
No error log in console

How To Reproduce

  1. Start with a LocalVideoTrack which has already started
  2. When the user switches from the front camera to the back camera (or vice versa) the following code is triggered:
  //this.videoTrack is an instance of LocalVideoTrack
  const promise = this.videoTrack.isVideoStarted ? 
    this.videoTrack.stop() : Promise.resolve();

  //Additional context:
  //For desktop browsers, the actual deviceId is passed to switchCamera()
  //For mobile browsers, MobileVideoFacingMode is passed to switchCamera()
  promise
    .then(() => this.videoTrack.switchCamera(value))
    .then(() => this.videoTrack.start(domElement)) 
    .catch(logError)
  1. Above code-snippet works as expected in desktop browsers. For mobile browsers, executing it for the first time results in a black preview video. Any subsequent execution of that snippet in mobile browsers then work as expected.

Correction: there is an error being thrown by:

this.videoTrack.start(domElement) 
//throws NotReadableError: Could not start video source sometimes
//after some retries it will eventually work

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.