I have a react application that should record audio from microphone and send it to a backend. The microphone input is implemented with navigator.mediaDevices.getUserMedia. The page runs perfectly over localhost and from other devices in my wifi network(for that I had to start my react app with https). But when I test it with this website: http://appsimulator.net/webapp/?frame=apple_iphone_6_v, I get the following error: TypeError: Cannot read property 'getUserMedia' of undefined. I don't know why it is not possible to test the app over this site.
This is answered directly in the MDN documentation for MediaDevices.getUserMedia():
Note: If the current document isn't loaded securely,
navigator.mediaDeviceswill beundefined, and you cannot usegetUserMedia(). See Security for more information on this and other security issues related to usinggetUserMedia().
AppSimulator.net is not presented securely, so this call will always fail in the manner you observed. Serve the page over HTTPS.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With