Camera or microphone works on localhost but not on a phone: getUserMedia needs HTTPS
@devsingh05▲ 15 net votes
navigator.mediaDevices is undefined, or permission is never asked, when the page is opened over plain HTTP from another device. Browsers allow camera, microphone and geolocation only on secure origins; localhost is the one exception and a LAN address like 192.168.x.x is not. To test on a phone, expose the dev server through an HTTPS tunnel or deploy a preview. On iOS the call must also come from a user gesture such as a tap.