# Wrong camera rendered during preview

**URL:** <https://devforum.zoom.us/t/wrong-camera-rendered-during-preview/101651>\
**Category:** Video SDK\
**Tags:** video-sdk\
**Created:** [January 11, 2024, 7:00pm UTC](https://devforum.zoom.us/t/wrong-camera-rendered-during-preview/101651 "2024-01-11T19:00:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicholas.calarco](https://avatars.discourse-cdn.com/v4/letter/n/7bcc69/32.png) [@nicholas.calarco](https://devforum.zoom.us/u/nicholas.calarco)\
**Post date:** [January 11, 2024, 7:00pm UTC](https://devforum.zoom.us/t/wrong-camera-rendered-during-preview/101651/1 "2024-01-11T19:00:37Z")

</div>

**Video SDK Type and Version**  
Web / ^1.10.1

**Description**  
`ZoomVideo.createLocalVideoTrack` **does not respect** `deviceId` parameter.

In our preview workflow, we are attempting to take the first device from `ZoomVideo.getDevices()` and apply that to our view. I can already see in this case that the first device in the list as well as the `deviceId` being passed is correct, but a different camera stream is being rendered.

**Error?**  
No errors reported.

**Troubleshooting Routes**  
We are using Angular, so, I originally wrote this logic using Observables rather than async/await or promises. I’ve since removed all of that and copy pasted the example code (found [here](https://developers.zoom.us/docs/video-sdk/web/preview/)), but that also does not work. Furthermore, I attempted manually entering the `deviceId` into the `ZoomVideo.createLocalVideoTrack` and that _still_ results in the wrong video being rendered.

**Example code**

```auto
ngOnInit() {
    ZoomVideo.getDevices().then((devices: MediaDeviceInfo[]) => {
      this.videoDevices = devices.filter((device: MediaDeviceInfo) => device.kind === 'videoinput');
      console.log('devices: ', this.videoDevices);
      console.log('first device: ', this.videoDevices[0].deviceId);
      this.localVideoTrack = ZoomVideo.createLocalVideoTrack(this.videoDevices[0].deviceId);
      console.log('localVideoTrack:', this.localVideoTrack);
    });
  }

  startCamera() {
    this.localVideoTrack.start(document.getElementById('preview-video') as HTMLVideoElement);
  }

```

In this case, the “first device” is my laptops embedded webcam. I have a second webcam attached to my laptop via usb. Every time I run this and check which device is returned at the 0-index of the device array, it’s always the embedded camera, yet, the external camera’s stream is always rendered, even if instead of passing in `this.videoDevices[0].deviceId` I pass the raw `deviceId`, it _still_ renders the external camera stream.

Please advise.

---

<div class="post-metadata">

**Author:** ![nicholas.calarco](https://avatars.discourse-cdn.com/v4/letter/n/7bcc69/32.png) [@nicholas.calarco](https://devforum.zoom.us/u/nicholas.calarco)\
**Post date:** [January 11, 2024, 7:48pm UTC](https://devforum.zoom.us/t/wrong-camera-rendered-during-preview/101651/2 "2024-01-11T19:48:12Z")

</div>

As an update, I tested this in Safari and Firefox, both of which appear to work correctly, while in Chrome this is not working.

My Chrome version: `Version 120.0.6099.216 (Official Build) (arm64)`.

---

<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:** [January 15, 2024, 9:49am UTC](https://devforum.zoom.us/t/wrong-camera-rendered-during-preview/101651/3 "2024-01-15T09:49:23Z")

</div>

Hey @nicholas.calarco

Thanks for your feedback.

When you open the video, is there another application also using the camera?

We will fix the camera setting issue in the next version.

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![nicholas.calarco](https://avatars.discourse-cdn.com/v4/letter/n/7bcc69/32.png) [@nicholas.calarco](https://devforum.zoom.us/u/nicholas.calarco)\
**Post date:** [January 15, 2024, 1:40pm UTC](https://devforum.zoom.us/t/wrong-camera-rendered-during-preview/101651/4 "2024-01-15T13:40:15Z")

</div>

Hi @vic.yang,

No other application is using either of my cameras while attempting this.

As another update, I ended up downloading the [react web demo](https://github.com/zoom/videosdk-web-sample) - this same issue occurs there in the preview demo. I tracked through the `preview.tsx` file and attempted to implement the same `switchCamera` logic in my Angular app, but again, no luck. It’s almost as if the `videosdk` is either doing it’s own device lookup or somehow getting locked onto a single video stream.

Thanks.
