Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS11 getUserMedia with apple web-app not working

Edit: Duplicate of How to access camera on iOS11 home screen web app?

I'm running into a problem with using a apple web-app together with camera access through the getUserMedia API.

I have some application that is working fine when accessed through safari, it asks for persmission to use the camera and upon approval I can see the camera feed. But if I save this same page to the home screen as an web-app this does not work anymore. There is no prompt for camera access, which seems to be the problem as it is not enabled by default.

The line that gives the problems is a meta tag which enables full screen for a web application on iOS.

<meta name="apple-mobile-web-app-capable" content="yes">

Anyone know what is going on here and why this fails? Do I need to set camera permission somehow through a meta tag also?

Thanks in advance!

like image 556
Evertvdw Avatar asked Sep 18 '17 09:09

Evertvdw


People also ask

Does getUserMedia work 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...

Does getUserMedia work on Safari?

getUserMedia is not supported for safari.

What is getUserMedia API?

getUserMedia API This API is used for accessing and controlling the media devices like the camera in our device. It is available in the navigator. mediaDevices object.

What is get user media?

getUserMedia() method prompts the user for permission to use up to one video input device (such as a camera or shared screen) and up to one audio input device (such as a microphone) as the source for a MediaStream .


Video Answer


1 Answers

Apple has removed the ability to use getUserMedia inside a UIWebView, WKWebView, SFSafariViewController, or a webpage that has been "added to the home screen".

The reasoning is not clear, however I do not believe this to be a bug.

An Apple staff member wrote this about WebRTC in iOS 11:

...right now, WebRTC is only supported in Safari. No WKWebView, not even SFSafariViewController.

And I can confirm that this includes the UIWebView as well (through personal tesing).

like image 57
Klathmon Avatar answered Oct 11 '22 01:10

Klathmon