I fired up the newly released Android 3.0 SDK to run some tests and found they’ve implemented part of the long-awaited Device API (aka the Media Capture API). From your browser you can now upload pictures and videos from the camera as well as sounds from the microphone. The returned data should be available to manipulate via the File API (although I haven’t yet tested this).
I made a short video demo with some explanation:
Here’s the code so you can play around with it for yourself!
- <form enctype="multipart/form-data" method="post">
- <h2>Regular file upload</h2>
- <input type="file"></input>
- <h2>capture=camera</h2>
- <input type="file" accept="image/*;capture=camera"></input>
- <h2>capture=camcorder</h2>
- <input type="file" accept="video/*;capture=camcorder"></input>
- <h2>capture=microphone</h2>
- <input type="file" accept="audio/*;capture=microphone"></input>
- </form>
<form enctype="multipart/form-data" method="post"> <h2>Regular file upload</h2> <input type="file"></input> <h2>capture=camera</h2> <input type="file" accept="image/*;capture=camera"></input> <h2>capture=camcorder</h2> <input type="file" accept="video/*;capture=camcorder"></input> <h2>capture=microphone</h2> <input type="file" accept="audio/*;capture=microphone"></input> </form>