All posts tagged ‘Camera API’

Picture Better Web Apps With Mozilla’s Camera API

Image: Mozilla

Mozilla is hard at work on a Camera API that will give web developers a way to access your phone’s camera. The Camera API will make it possible to build websites that can take pictures with your device’s camera and then upload them to that webpage. Throw in some CSS-based filters — perhaps a bit of JavaScript to add other image effects — and you’ve got Instagram, no native app necessary.

The Camera API is part of Mozilla’s larger WebAPI project, which is developing a set of APIs that will allow web apps to better compete with platform-native applications. To do that the WebAPI project will give developers access to your device’s hardware capabilities, like the camera, the calendar and even the vibration mechanism.

The WebAPI effort is a long way from complete, but the Camera API will work today on most Android devices. Mozilla’s Robert Nyman has a new post over at the Mozilla Hacks blog that walks through the basics of using the nascent Camera API, including a working demo you can test on your Android device using either Firefox or Chrome.

Bear in mind that, cool as the Camera API is, it’s not yet an official web standard. As with the rest of Mozilla’s WebAPI project, the Camera API is still very much in the development stage.

On the other hand, for those that want to experiment, the Camera API is much further along than some of the other WebAPIs. Adding to the appeal is the fact that the Camera API is being developed in conjunction with the W3C’s WebRTC spec, an effort to standardize a set of real-time audio and video streaming protocols. That means that an official standardized version of the Camera API will likely emerge sooner rather than later.

As it stands the Camera API is already supported in Firefox and Google Chrome on Android devices. Some of the other elements used in Nyman’s demo, like the JavaScript function createObjectURL are also supported in Internet Explorer 10. So far Apple’s Mobile Safari doesn’t support the Camera API or any of the JavaScript used to create the demo app.

For more info on Mozilla’s WebAPI efforts, check out the Mozilla wiki and for some additional Camera API ideas hit up the Mozilla Developer Network docs.