W3C has now released the draft for accessing the native camera or webcam of the device. The API for navigator.getUserMedia is still in draft stages but gives a good insight of things to come. As of now, no stable browser version has support for this API. We found an Opera Lab version for Android which seems to have support for this. Details are at http://my.opera.com/core/blog/2011/03/23/webcam-orientation-preview.
Using the above Opera version, we have managed to coin up our first HTML5 app which access the cellphone’s camera. The app can capture images via the camera and they can be stored in the local SQLite database which could be handy if there is no internet connectivity at that time. The app then allows you to transfer these images to a server which can manipulate them and store them. In our app, the images are added to an online image gallery. A video of the working app is shown below.
In case you want to try it out, please open the url http://html5.sapnagroup.com/gallery/camera.php on your Android phone. Before you view it, please download the Opera Lab version from http://people.opera.com/richt/release/build/Opera_Mobile_11_LABS_device_orientation_preview_20110323.apk and do the following as detailed below.
- Install Opera Lab version
- Type in about:config into the address bar
- Go to Security Prefs and tick ”Allow Camera To Canvas Copy”
- Open http://html5.sapnagroup.com/gallery/camera.php
- Click on the screen to capture an image
- This will store the captured screen locally into mobile storage
- Keep clicking more images
- Once you are onto wifi/3G coverage, click on the stored images (small thumbnails that appear below the capture screen) to upload to the server
- View your uploaded images at http://html5.sapnagroup.com/gallery/index.php
An app like this opens up opportunities to transfer photos from outdoor easily to any web based application. The next step to this would be to transfer videos and audio. We are still researching that.