jquery - navigator.getUserMedia is undefined on a php server that is not local, but locally it works perfectly
one text
I am making a platform that allows the capture and saving of a photo from the webcam, on localhost this works well, but when mounting it on a server that is not local, it does not work for me.
function turnOnCamera(){
canvas = document.getElementById("resultado");
cxt = canvas.getContext("2d");
video = document.getElementById("camara");
if(!navigator.getUserMedia){
navigator.getUserMedia = navigator.getUserMedia || navigator.webKitGetUserMedia || navigator. moxGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
}
if(!window.ULR){
window.ULR = window.webkitURL;
}
console.log(navigator.getUserMedia);
if(navigator.getUserMedia){
navigator.getUserMedia({"video":true, "audio":false},
function(stream){
try{
localstream = stream;
video.srcObject = stream;
video.play();
}catch(error){
video.srcObject = null;
}
},function(err){
console.log("Error :" + err);
});
}else{
console.log("Error :" + "No getUsermedia");
}
}
Console response is undefined
Source