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!
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...
getUserMedia is not supported for safari.
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.
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 .
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With