Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

134
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda