Does getUserMedia works on iOS?

Since iOS 11, getUserMedia is supposed to finally work on Apple devices.

But in fact it does not work.

The JavaScript sample code below works on all other OS: Blackberry, Android, etc...

Except on iOS as usual.


navigator.getUserMedia = ( navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia || navigator.mediaDevices.getUserMedia);


navigator.getUserMedia({video: true ,audio: false}, gotStream, noStream);


function gotStream(stream)

{

video.src = getUrl(stream);

}


When executed on a https connection, it asks for webcam detection, but nothing appears on the video: blank.

It is the same issue as described by other developers below:

https://stackoverflow.com/questions/45692526/ios-11-getusermedia-not-working


Was somebody able to have getUserMedia works on iOS?

Hi,


Did you get getusermedia working on any of the latest IOS 11 versions ?


Thanks


Nigel

Hi,


getusermedia working in iOS 11.3 in the safari browser but not working in chrome browser. if it is possible to make it work on chrome that would be great.anyone have any idea?


Thanks,

Dhanalakshmi

It's sad that Apple doesn't fully support WebRTC in the browser on iOS. Will they ever get their act together?

Is there any update on getUserMedia / Stream
Code Block
navigator.mediaDevices.getUserMedia(
{ audio: false,
video: {facingMode: { exact: "environment" },
width: 420, height: 1000 } })
.then(function(stream) {
var video = document.querySelector('video');
// Older browsers may not have srcObject
if ("srcObject" in video) {
video.srcObject = stream;
} else {
// Avoid using this in new browsers
video.src = window.URL.createObjectURL(stream);
}
})
.catch(function(err) {
console.log(err.name + ": " + err.message);
});


It doesn't wor on IPhone only

Its not working on my WKWebView also , not sure what am I missing. Using iOS14.6

Hey, I recently got the same problem. It will work if you add

autoPlay={true} playsInline={true} muted={true}

as arguments to your video element, since the problem is not caused by getUserMedia, but from the video element. The code should look like this:

<video
autoPlay={true}
playsInline={true}
muted={true}
ref={videoRef}></video>

videoRef is of course your personal ref in your code.

Hope it helps everyone that has the same problem!

Thank You , Thank You, Thank You!!!!!!

I have spent days troubleshooting this problem. Our code would work on desktop and iPad, but not on iPhone. The 'NotAllowedError' made me believe the problem was with getUserMedia() or the Permissions-Policy response headers. Your post saved the day :-) I'm so grateful you took the time to post it!

We already had autoPlay="true" and muted="true" in our video element - it was the adding of playsInline="true" that did the trick.

Thanks again!

Hello,

I have a problem with navigator.mediaDevices.getUserMedia({ audio: true, video: true }) on IOS 16.4. When i use it first time i got an error "AbortError". Safari on macOs have the same problem... Are there any suggestion?

Does getUserMedia works on iOS?
 
 
Q