HTML5 Safari iOS access for camera only, not photo library
<input type="file" capture="camera" accept="image/*">
allows the mobile browser to take a picture. In Android browser and Chrome, by pressing the enter button, the camera will instantly launch the camera. On iOS Safari, the button triggers an alert asking you to "take a photo" or select "Photo Library". How can I start my own camera right away?
source to share
It has to do with who supports WebRTC . Safari is not currently supported, partially supported by Chrome on Android, experimental support for Firefox on Android. On Android, the default is to use the front camera. Future work will allow us to select a camera from javascript, but this feature is only experimental in FireFox.
source to share
This is currently not possible for iOS.
iOS6-10 does not support an attribute capture
that is designed to force the user agent to use the camera rather than Photo Library.
The attribute capture
is part of HTML Media Capture.
PS: You can improve your code by replacing capture="camera"
with capture
. In 2012, the capture attribute was changed from 4 lines to boolean in the HTML Media Capture spec .
source to share