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

129
Views
mediaDevices enumerateDevices returns non-existent video input

I need to show a button depending on the existance of a camera where the web app is being run. I have the following code to detect such existence of a camera

const availableMediaOnDevice = await window.navigator.mediaDevices?.enumerateDevices();
console.log("devices ->", availableMediaOnDevice);
const deviceHasOwnCamera = availableMediaOnDevice.some(
  (device) => device.kind === "videoinput"
);

This happens to work fine running on a local IIS on my desktop computer. If I plug a usb camera I get a videoinput and if I unplug it then the device is removed when doing enumerateDevices() again.

However, when I deploy this to our testing environment and visit the website using the same desktop computer when enumerateDevices() runs I always get a videoinput device. The groupId happens to change when I unplug the camera but then it is set back to the original value when I plug it again.

Something that is also different is that locally I get a label value "FaceCam 2020" while on the test env I get an empty label regardless of if the camera is connected or not. This makes me think that perhaps this is related to permissions but then I'd expect that the videoinput would never show on test instead of the opposite.

about 4 years ago · Juan Pablo Isaza
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!