Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

131
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda