CameraManager.getCamera Redirect 1

Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

This API is available on Firefox OS for certified applications only.

Summary

This method is used to access to one of the cameras available on the device based on its identifier. You can get a list of the available cameras by calling the CameraManager.getListOfCameras() method.

Syntax

CameraManager.getCamera(options, onsuccess[, onerror]);

Parameters

options
An object containing a property camera with the identifier of the camera to use.
onsuccess
A callback function that take a CameraControl object as parameter.
onerror
An optional callback function that accepts an error string as a parameter.

Example

var options = {
  camera: navigator.mozCameras.getListOfCameras()[0]
};

function onSuccess(camera) {
  // Do stuff with the camera
};

function onError(error) {
  console.warn(error);
};

navigator.mozCameras.getCamera(options, onSuccess, onError)

Specification

Not part of any specification; however, this API should be removed when the WebRTC Capture and Stream API has been implemented.

See also

Document Tags and Contributors

 Last updated by: Sheppy,