# createLocalVideoTrack switchCamera only switches to built-in laptop camera on FireFox

**URL:** <https://devforum.zoom.us/t/createlocalvideotrack-switchcamera-only-switches-to-built-in-laptop-camera-on-firefox/118515>\
**Category:** Web\
**Created:** [October 2, 2024, 11:28pm UTC](https://devforum.zoom.us/t/createlocalvideotrack-switchcamera-only-switches-to-built-in-laptop-camera-on-firefox/118515 "2024-10-02T23:28:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jon-L](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jon-l/32/55248_2.png) [@Jon-L](https://devforum.zoom.us/u/Jon-L)\
**Post date:** [October 2, 2024, 11:28pm UTC](https://devforum.zoom.us/t/createlocalvideotrack-switchcamera-only-switches-to-built-in-laptop-camera-on-firefox/118515/1 "2024-10-02T23:28:30Z")

</div>

**Video SDK Type and Version**  
Web / 1.12.5

**Description**  
The local video preview version of the switchCamera function does not seem to respect the deviceId parameter (Firefox only).

I can create a local video track with createLocalVideoTrack. This will successfully display any camera based on the deviceId I pass in. However, if I attempt to use localVideoTrack.switchCamera(deviceId), the camera always switches to the built-in camera on my laptop.

When I attempt to switch to a camera other than the built-in webcam, the canvas shows the image from the built-in webcam, but cropped to what appears to be a 4:3 aspect ratio.

This is not an issue with mediaStream’s switchCamera, which works as expected.

**Error?**  
No errors shown.

**Troubleshooting Routes**  
I have verified that this happens when passing the deviceId strings of each camera directly. This does not occur on Chrome, switchCamera works as expected on Chrome.

**How To Reproduce**  
Using Firefox 130.0.1

this.localVideoTrack = this.zmSdk.createLocalVideoTrack(deviceId)  
await this.localVideoTrack.start(canvas)  
…  
this.localVideoTrack.switchVideo(newDeviceId)

---

<div class="post-metadata">

**Author:** ![vic.yang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vic.yang/32/24656_2.png) [@vic.yang](https://devforum.zoom.us/u/vic.yang)\
**Post date:** [October 9, 2024, 10:19am UTC](https://devforum.zoom.us/t/createlocalvideotrack-switchcamera-only-switches-to-built-in-laptop-camera-on-firefox/118515/2 "2024-10-09T10:19:23Z")

</div>

Hey @Jon-L

Thanks for your feedback.

I tested the same function on Firefox 131.0 , it works as expected.

Could you help check the device ID is correct? The following code is a simple example to get the device IDs:

```javascript
navigator.mediaDevices
    .enumerateDevices()
    .then((devices) => {
      devices.forEach((device) => {
        console.log(`${device.kind}: ${device.label} id = ${device.deviceId}`);
      });
    })
    .catch((err) => {
      console.log(`${err.name}: ${err.message}`);
    });

```

Thanks  
Vic

---

<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:** [November 8, 2024, 8:20pm UTC](https://devforum.zoom.us/t/createlocalvideotrack-switchcamera-only-switches-to-built-in-laptop-camera-on-firefox/118515/3 "2024-11-08T20:20:22Z")

</div>

Closed on November 8, 2024, 8:20pm UTC

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