Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you launch the native Camera App from an Html 5 Web App?

I have a mobile website that allows users to upload photos using the file input type (Browse button). If possible, I would like to launch the Camera App of an Android device on click of the Browse button or any other HTML button. Is this possible?

I read this similar post but in their example they are asking how to register the Camera App as Intent Receiver for uploading images. Similar to that, I just want to launch the Camera App in the same way the Android browser picks up on Phone Number and Addresses.

like image 604
shanabus Avatar asked Oct 06 '11 14:10

shanabus


People also ask

Can a web app access Android camera?

On Android devices, you can access the camera from the Browser widget. The feature is available on devices with Android OS 5.0 and later.

Can a web app use phone camera?

Thankfully, it's very simple, HTML5 has a useful element which allows taking a picture from a mobile device. If the user clicks into the input field they will be prompted to use their camera on the site.

How do I capture an image in HTML?

The capture attribute is supported on the file input type. The capture attribute takes as its value a string that specifies which camera to use for capture of image or video data, if the accept attribute indicates that the input should be of one of those types. The user-facing camera and/or microphone should be used.

What is native camera android?

Android 7.0 Nougat (API level 24) introduced the native camera API, which finally allowed fine-grained control of camera directly from C++. The new API allows you to access image data directly in C, without the need to pass them from Java. Therefore, there might be some (small) performance gain.


2 Answers

Android 3.0 Honeycomb added Device API support. Google I/O 2011 presentation shows an example on slide 30:

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

It also points to a test site that not surprisingly does not do much on my Froyo phone.

Anybody with a tablet tried it and can tell us what it does and does not do?

4.0 Icecream Sandwich was announced. Code drop may not happen for several months or longer and actual devices may show in the market around Christmas. As to Icecream on current generation of Froyo / Gingerbread phones, official ODM/carrier 4.0 releases will never happen? I'd love to be proved wrong on this. Any word from custom ROMs community?

like image 189
Walter K Avatar answered Sep 18 '22 15:09

Walter K


I tried this:

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

from here: https://coderwall.com/p/epwmoa

With my Galaxy S2 phone (on Chrome).

It's working and open directly the camera.

like image 30
paaacman Avatar answered Sep 20 '22 15:09

paaacman