Reputation: 1397
While I am working on basic React example with WebRTC (simple-peer) :
navigator.mediaDevices.getUserMedia({ video: true, audio: true }).then(stream => {
setStream(stream);
if (userVideo.current) {
userVideo.current.srcObject = stream;
}
})
I get the error as below :
I see that navigator.mediaDevices.getUserMedia is compatible with Chrome on android so I wonder what causes this issue here. Kindly help on this.
Upvotes: 0
Views: 3011
Reputation: 2641
Whiltelist your server by opening chrome://flags
and search for unsafely-treat-insecure-origin-as-secure
:
chrome://flags/#unsafely-treat-insecure-origin-as-secure
and add your server name http://foobar
, relaunch chrome.
NOTE
This should be used only for testing!!!
Upvotes: 2
Reputation: 59
I also had the same problem. The mobile browser hasn't asked about permissions. Just try it on Secure Connection (ie: https, SSL).
Upvotes: 2