iOS 11 Getusermedia Not Working

iOS 11 getUserMedia not working?

Solved it by using the following:

$(function () {
video = document.getElementById('vid');
video.style.width = document.width + 'px';
video.style.height = document.height + 'px';
video.setAttribute('autoplay', '');
video.setAttribute('muted', '');
video.setAttribute('playsinline', '');

var constraints = {
audio: false,
video: {
facingMode: 'user'
}
}

navigator.mediaDevices.getUserMedia(constraints).then(function success(stream) {
video.srcObject = stream;
});
});

mediaDevices.getUserMedia not working with Safari 11 in iOs 11 (video is black)

The problem is not in API as you said, it's because mobile browser needs a valid click event to start playing video, so video.play() will not work on mobile without user interaction. For example, this post is proving it: https://stackoverflow.com/a/16860922/6053654. What I usually do: I just add play icon over the video (only on mobile) to induce user to click, and then, I bind video.play() to this click event. Sounds simple.

iOS 11 Public beta 5 getUserMedia not working

getUserMedia requires HTTPS unless you use the "allow media capture on insecure sites" shown in the first screenshot of this webkit blog post



Related Topics



Leave a reply



Submit