Dexter Cato
Dexter Cato

Reputation: 1191

How can I access iPhone or Android camera using HTML5?

I am trying to create a web application to be built on HTML5 for iPhone or Android browser. How will I be able to access the camera on both instance for me to capture an image and upload it to the web application?

Upvotes: 3

Views: 16152

Answers (6)

Lee Irvine
Lee Irvine

Reputation: 3367

WebRTC protocols are a good place to look

Upvotes: 0

sagus_helgy
sagus_helgy

Reputation: 1437

You can access to camera! Example http://davidwalsh.name/demo/camera.php . I have tested it on my Nexus 4

Upvotes: 0

Eric F.
Eric F.

Reputation: 329

Is this work in your case?

<input type="file" accept="image/*" capture="camera" />

Upvotes: 2

Milan Korsos
Milan Korsos

Reputation: 33

With iOS6, Apple takes HTML5 photo upload.

http://clubsexytime.com/projects/mobileupload/

Upvotes: 2

sparkymat
sparkymat

Reputation: 10028

I don't think this is possible. At least, in the current state, HTML5 cannot access the camera (or other peripherals). An alternative would be to create a PhoneGap application, where you can develop the app in HTML5 (which will be wrapped into a native application), with additional libraries (JS) which let you access these.

More info on PhoneGap: http://phonegap.com/start Camera api on PhoneGap: http://docs.phonegap.com/en/1.0.0/phonegap_camera_camera.md.html

Upvotes: 3

Ian Devlin
Ian Devlin

Reputation: 18870

You can't at the moment. Once the W3C getUserMedia API is finalised and implemented by browsers this will be possible, but right now it isn't. (Opera Mobile have a version that implements it - out of interest).

Upvotes: 2

Related Questions