0

Im facing with an issue on desktop Safari 13.1 version. If I open the console in the web inspector (with a regular macbook which has webcam and mic) and execute this command on any kind of website:

navigator.mediaDevices.enumerateDevices()

First time it will return in the Promise result with a videoinput and an audioinput. Second time it will return only 2 audioinput. Videoinput is disappear.

Unfortunately I call this method several times while checking the available devices on my solution.

Any idea why does it happen and how could I get the accurate information about the devices even If I call it more than once? See the results here

1 Answer 1

1

I've found the same issue, also on my iPad running iOS 13.

It seems you need to request camera access first in order to see the correct device list.

navigator.mediaDevices.getUserMedia({ video: true })

This will prompt you for access to the camera (you need to be on HTTPS or localhost).

Grant permission, then run this again and you should see the videoinput device(s) listed in the returned promise:

navigator.mediaDevices.enumerateDevices()

I guess this makes sense as a privacy feature that a website cannot check if a camera exists without first asking your permission.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.