Can you access the iPhone camera from Mobile Safari?

55,143

Solution 1

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.

Solution 2

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.

Solution 3

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/

Solution 4

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.

Share:
55,143
kim3er
Author by

kim3er

Mainly .NET, Node, and Cordova.

Updated on August 05, 2020

Comments

  • kim3er
    kim3er almost 4 years

    Is there a JavaScript API for accessing the the iPhone's camera from Mobile Safari?

  • jriskin
    jriskin over 12 years
    Phonegap allows you to build native apps, it won't help for accessing from the web via Safari.
  • Rajesh
    Rajesh over 12 years
    Think 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.
  • subhaze
    subhaze almost 12 years
    Answer to old comment, but relevant. This is why you wouldn't need it for Android hacks.mozilla.org/2012/04/…
  • Johannes Klauß
    Johannes Klauß over 10 years
    This should be the accepted answer, since the old one isn't correct anymore.
  • James Westgate
    James Westgate over 10 years
    Modified the answer which was incorrent.
  • Adil Malik
    Adil Malik about 10 years
    Can I somehow remove the Choose Existing button? I want the video to be uploaded directly from camera only.
  • Simon Arnold
    Simon Arnold about 10 years
    Good question @AdilMalik! Unfortunately, not that I'm aware of, but if you find a way, let me know.
  • Raj
    Raj over 9 years
    Just by using standard HTML file input type: <form action="POST"> <input type="file" name="pic"> <input type="submit"> </form>
  • Joel B
    Joel B over 9 years
    As an addendum to this, it looks like HTML5 offers some interesting ways to get webcam images/video: html5rocks.com/en/tutorials/getusermedia/intro