dimanche 22 octobre 2017

getUserMedia not working for mobile

help, I am not sure why but my web app is working perfectly with laptop (chrome, safari) but it wouldn't work with any browser in mobile version. How should I make it so that getUserMedia work for all devices? I also tried things like commenting out the playback. The video does not show up, and does not even ask for camera permission.

/* Setting up the constraint */
var facingMode = "user";
var constraints = {
  audio: false,
  video: {
    facingMode: facingMode
  }
};

/* Stream it to video element */
navigator.getUserMedia = navigator.getUserMedia || 
navigator.webkitGetUserMedia ||
   navigator.mozGetUserMedia || navigator.msGetUserMedia || 
navigator.mediaDevices.getUserMedia;
navigator.mediaDevices.getUserMedia(constraints).then(function success(stream) {
   video.srcObject = stream;
});




Aucun commentaire:

Enregistrer un commentaire