I'm currently developing application using the camera for iphone in HTML5 with
<input type="file" accept="capture=camera">
The problem is that I have a little list that give me the choose between my library and my camera.
My idea is to have two buttons, one for the library and an other for the camera.
I know the way to only give the library but not for the camera.
Question: Is there a way to separate the two types?
Unfortunaly not possible :/
Extract from HTML Media Capture - Security and privacy considerations :
I had this problem too, I didn't come across a solution, I only found unofficial sources stating that this is not possible. All you can do is require either
video/*
orimage/*
via theaccept
attribute.Write the following takePhoto acton method:
Finally, we do the same for the selectPhoto action method, but changing the sourceType to UIImagePickerControllerSourceTypePhotoLibrary.
Implementing the Delegate Methods of UIImagePickerController
When the user takes a photo with the camera and resizes the image (photo resizing is allowed since we said allowsEditing = YES when we created the image picker). It is a NSDictionary which contains, among other things, the original image and the edited image (accessible through the tag UIImagePickerControllerEditedImage).
It is not possible in iOS6 through 10. It does work on Android 3.0+.
The
capture
attribute, introduced by HTML Media Capture, should force iOS to jump straight to the cam app but it's not supported.From the spec:
PS: Your code is slightly incorrect, you should use
<input accept="video/*,image/*" capture >
to:See Correct HTML Media Capture Syntax for more details.