# Mobile Browser LocalVideoTrack.SwitchCamera Reesulting to Black Preview

**URL:** <https://devforum.zoom.us/t/mobile-browser-localvideotrack-switchcamera-reesulting-to-black-preview/126889>\
**Category:** Web\
**Tags:** video-sdk\
**Created:** [February 14, 2025, 3:49pm UTC](https://devforum.zoom.us/t/mobile-browser-localvideotrack-switchcamera-reesulting-to-black-preview/126889 "2025-02-14T15:49:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lukaz](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/lukaz/32/67192_2.png) [@Lukaz](https://devforum.zoom.us/u/Lukaz)\
**Post date:** [February 14, 2025, 3:49pm UTC](https://devforum.zoom.us/t/mobile-browser-localvideotrack-switchcamera-reesulting-to-black-preview/126889/1 "2025-02-14T15:49:26Z")

</div>

**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:

```auto
  //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.

---

<div class="post-metadata">

**Author:** ![Lukaz](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/lukaz/32/67192_2.png) [@Lukaz](https://devforum.zoom.us/u/Lukaz)\
**Post date:** [February 18, 2025, 4:59am UTC](https://devforum.zoom.us/t/mobile-browser-localvideotrack-switchcamera-reesulting-to-black-preview/126889/2 "2025-02-18T04:59:32Z")

</div>

Correction: there is an error being thrown by:

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

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [March 20, 2025, 3:00pm UTC](https://devforum.zoom.us/t/mobile-browser-localvideotrack-switchcamera-reesulting-to-black-preview/126889/3 "2025-03-20T15:00:11Z")

</div>

Closed on March 20, 2025, 3:00pm UTC

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