Is there a JavaScript API for accessing the the iPhone's camera from Mobile Safari?
4 Answers
Since iOS6, you can use
<input type="file" accept="image/*" capture="camera">
<input type="file" accept="video/*" capture="camera">
It will act like a regular file upload, but instead, it will open the iPhone camera and upload a picture or a video.
Hope this help someone.
-
3This should be the accepted answer, since the old one isn't correct anymore. Commented Nov 19, 2013 at 8:28
-
3Can I somehow remove the
Choose Existing
button? I want the video to be uploaded directly from camera only. Commented Apr 17, 2014 at 14:27 -
Good question @AdilMalik! Unfortunately, not that I'm aware of, but if you find a way, let me know. Commented Apr 17, 2014 at 14:47
-
As an addendum to this, it looks like HTML5 offers some interesting ways to get webcam images/video: html5rocks.com/en/tutorials/getusermedia/intro– Joel BCommented Oct 27, 2014 at 18:01
You can via http://picupapp.com/
It is a Free iPhone App and JS that can convert an upload box into a button that requests the app, along with instructions to the App on where to post the image...
This thing should get an award.
Now if only we could get them to also make it work perfect with Android and Blackberry.
-
1Think about it. The person is trying to make a mobile version of a web site that has the ability to capture images from a phone's camera. I'm pretty sure that people accessing a web app wouldn't be exclusively iOS users.– MateoCommented Jan 23, 2012 at 17:21
-
Answer to old comment, but relevant. This is why you wouldn't need it for Android hacks.mozilla.org/2012/04/…– subhazeCommented Jul 25, 2012 at 0:44
There is a specification from the W3C which would allow this, although to my knowledge none has implemented it yet: http://www.w3.org/TR/2010/WD-html-media-capture-20100928/
-
7Phonegap allows you to build native apps, it won't help for accessing from the web via Safari.– jriskinCommented Nov 10, 2011 at 5:45
-
Chrome and Safari on iOS7 can access the Camera and the Camera Roll without any special markup and can perform both AJAX POST and synchronous form POST operations just like a desktop browser.
-
1Just by using standard HTML file input type:
<form action="POST"> <input type="file" name="pic"> <input type="submit"> </form>
– RajCommented Oct 6, 2014 at 13:43