I have a problem when detecting support for getUserMedia. I am using Android 4.2.2.
The problem is that the android browser acts as if it have support for getUserMedia but when using it, I neither get a call to the success function nor the fail function. Code below:
function onCameraFail(e){
alert("Failed getting media");
}
if (navigator.webkitGetUserMedia) {
alert("getMedia supported");
navigator.webkitGetUserMedia({video:true}, function (stream) {
alert("Got media");
}, onCameraFail);
alert("after getMedia");
}else{
//Old device, no support for providing a photo
alert("No support for getUserMedia");
}
When on Android browser, this code shows the popup "getUserMedia supported" but I never get any popup that says "Got media" or "Failed getting media". When running the same code in Chrome on Android, it says "No support for getUserMedia"
Why this behavior? I thought that this was the common way to check for support of functions.
GetUseMedia is not supported in Android Browsers.
http://caniuse.com/stream
getUserMedia(constraints, successCallBack, errorCallBack)
In errorCallBack, check for the error you are getting. You should get the exact reason every time.