# getMicList always returns empty array

**URL:** <https://devforum.zoom.us/t/getmiclist-always-returns-empty-array/79080>\
**Category:** Web\
**Created:** [November 21, 2022, 1:06am UTC](https://devforum.zoom.us/t/getmiclist-always-returns-empty-array/79080 "2022-11-21T01:06:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bradley.dotnet](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/bradley.dotnet/32/42955_2.png) [@bradley.dotnet](https://devforum.zoom.us/u/bradley.dotnet)\
**Post date:** [November 21, 2022, 1:06am UTC](https://devforum.zoom.us/t/getmiclist-always-returns-empty-array/79080/1 "2022-11-21T01:06:05Z")

</div>

**Description**  
`Stream.getMicList()` is returning an empty array, even when navigator.mediaDevices.enumerateDevice() returns several speakers and microphones

**Browser Console Error**  
Logging out the result of `getMicList` results in an empty array

**Which Web Video SDK version?**  
^1.5.1

**Video SDK Code Snippets**

```auto
      map(stream => stream?.getMicList()),
      tap(list => console.warn('mics', list))

```

Using rxJS to control access to the stream object, but it is populated and seems to be valid. I can call `startAudio` on it just fine. Calling this first does not seem to resolve the issue

**Troubleshooting Routes**  
Tried starting audio first, or passing in the native device ID t o`switchMicrophone`

**Device (please complete the following information):**  
Latest Chrome and Brave browsers

---

<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:** [November 21, 2022, 1:39am UTC](https://devforum.zoom.us/t/getmiclist-always-returns-empty-array/79080/2 "2022-11-21T01:39:19Z")

</div>

Hey @bradley.dotnet

Thanks for your feedback.

`stream.getMicList()` is almost the same as the `navigator.mediaDevices.enumerateDevice()`, but it’s a synchronous function.

As you know, the label of the media devices is empty until permission is granted.

In Video SDK, in order to have a consistent return value, the `stream.getMicList()` will return an empty array until the user starts video/audio or the devices change.

Using `stream.switchMicrophone` method to switch to the specific mic if you want.

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![bradley.dotnet](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/bradley.dotnet/32/42955_2.png) [@bradley.dotnet](https://devforum.zoom.us/u/bradley.dotnet)\
**Post date:** [November 21, 2022, 3:50am UTC](https://devforum.zoom.us/t/getmiclist-always-returns-empty-array/79080/3 "2022-11-21T03:50:43Z")

</div>

Ok, I thought I tried that but apparently not the right way. Doing it again does show the microphones after I call `startAudio`.

Is there a way to get the permission check without calling that? My goal was to provide a “join dialog” that also let the user pick their devices. The side-effect is that it enforces a user action before calling `startAudio` on a refresh of the page which doesn’t work if I need it for the dropdown.

Obviously I could start the audio then mute it, but that seems like a bit of a workaround. It also doesn’t accomodate the lack of a user action without trying to lazy-load the dropdown (which then begs the question, how do I get the initial label).

Thanks for the quick reply!

---

<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:** [November 21, 2022, 7:20am UTC](https://devforum.zoom.us/t/getmiclist-always-returns-empty-array/79080/4 "2022-11-21T07:20:28Z")

</div>

Hey @bradley.dotnet

We do provide an API `ZoomVideo.getDevices()` to get the devices list. It can be called before joining the session.

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![bradley.dotnet](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/bradley.dotnet/32/42955_2.png) [@bradley.dotnet](https://devforum.zoom.us/u/bradley.dotnet)\
**Post date:** [November 22, 2022, 12:35am UTC](https://devforum.zoom.us/t/getmiclist-always-returns-empty-array/79080/5 "2022-11-22T00:35:27Z")

</div>

Ah thanks. Looks like that has basically the same response as `enumerateDevice`. The device IDs are the same as `getMicList` so I’m guessing I just needed to start the audio before calling `stream.switchMicrophone` (previously it said that I had an invalid device ID there.

I’ll keep testing but thanks for the quick help!

---

<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:** [November 22, 2022, 1:21am UTC](https://devforum.zoom.us/t/getmiclist-always-returns-empty-array/79080/6 "2022-11-22T01:21:46Z")

</div>

Hey @bradley.dotnet

Correct.

Thanks for sharing your solution.

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:** [December 22, 2022, 2:43pm UTC](https://devforum.zoom.us/t/getmiclist-always-returns-empty-array/79080/8 "2022-12-22T14:43:45Z")

</div>

Closed on December 22, 2022, 2:43pm UTC

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