ZoomVideo.getDevices() Not working properly on every browser

Description
Hi, team.
I have a preview screen that calls the ZoomVideo.getDevices() on mount, but this returns different results on different browsers. In the worst case, it does not return any devices at all.

Is there a reason this happens? And there is no error on the browser console.

Note: This happens even when the permissions are granted and no other applications are using the camera/audio devices.

Which Web Video SDK version?
1.9.5.

Video SDK Code Snippets

const mountDevices: () => Promise<{
  mics: MediaDevice[];
  speakers: MediaDevice[];
  cameras: MediaDevice[];
}> = async () => {
  allDevices = await ZoomVideo.getDevices();
  const cameraDevices: Array<MediaDeviceInfo> = allDevices.filter((device) => {
    return device.kind === 'videoinput';
  });
  const micDevices: Array<MediaDeviceInfo> = allDevices.filter((device) => {
    return device.kind === 'audioinput';
  });
  const speakerDevices: Array<MediaDeviceInfo> = allDevices.filter((device) => {
    return device.kind === 'audiooutput';
  });
  return {
    mics: micDevices.map((item) => {
      return { label: item.label, deviceId: item.deviceId };
    }),
    speakers: speakerDevices.map((item) => {
      return { label: item.label, deviceId: item.deviceId };
    }),
    cameras: cameraDevices.map((item) => {
      return { label: item.label, deviceId: item.deviceId };
    })
  };
};

before component displays I use the code below to prepopulate the devices

useMount(() => {
    PREVIEW_VIDEO = document.getElementById('js-preview-video');
    mountDevices().then((devices) => {
      console.log('devicesdevicesdevicesdevices', devices);
      setMicList(devices.mics);
      setCameraList(devices.cameras);
      setSpeakerList(devices.speakers);
      if (devices.speakers.length > 0) {
        setActiveSpeaker(devices.speakers[0].deviceId);
        setActiveMicSpeaker(devices.speakers[0].deviceId);
      }
      if (devices.mics.length > 0) {
        setActiveMicrophone(devices.mics[0].deviceId);
      }

      if (devices.cameras.length > 0) {
        setActiveCamera(devices.cameras[0].deviceId);
      }
    });
  });

I would greatly appreciate you feedback. Thanks.

Screenshots
Below screen shot is from Chromium browser, no devices loaded.

Hey @godwin.owonam

Thanks for your feedback.

It depends on the browser. Can you try this official WebRTC sample?

Thanks
Vic

Hi @vic.yang
Thanks for your response. It appears this is the same thing that the ZoomVideo.getDevices() method is supposed to do. And the problem is not that it doesn’t work at all, but that it doesn’t work on some devices.

I have visited the site you shared. On my Android Mozilla Firefox browser, the speakers (audiooutput) devices are not listed but default and greyed out (disabled). But it works fine on my Desktop Firefox browser.

Any ideas why it is so?
Also, I would prefer to know why nothing was returned with the Chromium browser by the Zoom Video SDK API because my project is based on that.

Or are you suggesting that I use the demo you shared instead of the SDK API?

Hi @vic.yang I have checked the demo you suggested, the issues are still the same. The browsers do not return the same results on the same device.

From Firefox: you can see that no audio output device is listed

From Chrome: You can see that the default audio output device is listed, although greyed-out.

Is there a solution that follows from the Zoom SDK API?

Hey @godwin.owonam

This may be the limitation of the browser’s capabilities, which would require the browser vendor to implement.

Thanks
Vic