Thursday, February 24, 2011

Android 3.0 Honeycomb is first to implement the Device API | David B. Calhoun – Developer Blog

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!

  1. <form enctype="multipart/form-data" method="post">  
  2.   <h2>Regular file upload</h2>  
  3.   <input type="file"></input>  
  4.   
  5.   <h2>capture=camera</h2>  
  6.   <input type="file" accept="image/*;capture=camera"></input>  
  7.   
  8.   <h2>capture=camcorder</h2>  
  9.   <input type="file" accept="video/*;capture=camcorder"></input>  
  10.   
  11.   <h2>capture=microphone</h2>  
  12.   <input type="file" accept="audio/*;capture=microphone"></input>  
  13. </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>

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More