Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

312
Views
mediaDevices.enumerateDevices() returns empty deviceId even after getting permissions

The problem I have has been discussed in several questions on this site: When I call mediaDevices.enumerateDevices(), the field deviceId is empty. The best question about this I could find is this one. The answer explains that you need to ask the user for permission before enumerating the devices. Should it still not work after getting permission, "you did something wrong".

And this is exactly the situation I'm in. I even cloned the WebRTC example mentioned in the answer. If I run the actual website, everything works fine. But if I run it locally, I not only see no device names, the lists are also limited to one entry, as if I've never give permission.

The only other lead I have is a comment from the accepted answer of this question, which reads:

Note that the enumerate calls don't work on a local dev machine. They have to be deployed to your website in order to function properly.

This sounds like a potential solution to the problem, however I have some doubts.

  1. Neither the documentation, nor any other discussion about this topic mention anything like that being the case.
  2. The enumeration basically works. I see the correct number of audio and video inputs, just the IDs are empty, as if I've not given permission.
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

After giving permissions to video and audio to the page, you should see the list of inputs with their respective id's, here is and example:

await navigator.mediaDevices.getUserMedia({video: true, audio: true})

You can request permissions to access devices by accessing the MediaStream

After that you can fully access the input list.

await navigator.mediaDevices.enumerateDevices()
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!