Navigator.getusermedia Not Working On Android / Chrome
Solution 1:
I've had the same problem. Mobile browser even haven't asked about permissions. And the reason was SSL! You have to use secure connection
Check "Secure context required" section here
Solution 2:
According to MDN, navigator.getUserMedia()
is deprecated and isn't supported on Android/Chrome and some newer browser versions. Use navigator.mediaDevices.getUserMedia()
instead. You can check browser compatibility below.
MDN Navigator.getUserMedia browser check
Here's a partial example I've used to access the camera for video streaming in a past project. The browser should ask the user for access on the device.
if(navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
navigator.mediaDevices.getUserMedia({ audio: false, video: cameraOrientation })
.then(function(stream) {
if ("srcObject"in video) {
video.srcObject = stream;
} else {
video.src = window.URL.createObjectURL(stream);
}
video.onloadedmetadata = function(e) {
video.play();
};
});
};
Solution 3:
Well, I was also having the same problem, But I solved it, My camera was blocked, U might have blocked it too, Go to settings and check the site settings,
I hope it helps U
Post a Comment for "Navigator.getusermedia Not Working On Android / Chrome"