How to switch cameras when previewing locally?

ZoomVideo.createLocalVideoTrack(deviceId?: string) It doesn’t work to set deviceId

Browser Console Error

Which Web Video SDK version?
@zoom/videosdk 1.1.7

Video SDK Code Snippets
const devices = await ZoomVideo.getDevices();
const videoDevices = devices.filter(function (device) {
return device.kind === ‘videoinput’;
// select external camera,my selected camera is Logitech C505e
const selectedCamera = videoDevices[2];
const selectedCameraId = selectedCamera.deviceId;
const localVideoTrack = ZoomVideo.createLocalVideoTrack(selectedCameraId);
console.log(‘selectedCamera:’, selectedCamera); // selectedCamera.label is ‘C505e HD Webcam #3 (046d:08e4)’
await localVideoTrack.start(document.getElementById(“js-preview-video”));
console.log(‘localVideoTrack:’, localVideoTrack);
console.log(‘video tracks:’, localVideoTrack.videoStream.getVideoTracks()); // MediaStreamTrack.label is ‘FaceTime高清摄像头(内建) (05ac:8514)’

Device (please complete the following information):

  • Device: [Macbook Pro]
  • OS: [macOS 11.3.1]
  • Browser: [Chrome]
  • Browser Version [95.0.4638.54 (Official Build) (x86_64)]

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