my android phone is connected to a web server through a webview. in my HTML I have a button to upload a photo. the user should have the choice to upload an image or take a photo from camera. my HTML code is:
<div class="takePhoto">
<form id="take" action="" method="POST">
<input type="file" id= "cap" name="personalPhoto" accept="image/*" capture ="camera" id="camera"><p>
</form>
</div>
However when I click on the button the file chooser opens and I have the ability to choose images but not to use the camera. Any solution for this?
P.S. in my code the word (capture) doesn't have a special style or color which I find weird and this might be the problem!
For this we are going to use Navigator media Devices. Navigator Media Devices: It is a read-only property that returns a Media Devices object, which helps us to access the connected media input devices like camera and microphone. Syntax : var mediaDevices = navigator.
In iPhone iOS6 and from Android ICS onwards, HTML5 has the following tag which allows you to take pictures from your device:
<input type="file" accept="image/*" capture="camera">
you can also try
<input type="file" accept="image/*" capture="capture">
or
<input type="file" accept="image/*;capture=camera">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With