mozilla
Your Search Results

    CameraControl.focusAreas

    Non-standard
    This feature is not on a current W3C standards track, but it is supported on the Firefox OS platform. Although implementations may change in the future and it is not supported widely across browsers, it is suitable for use in code dedicated to Firefox OS apps.

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

    Summary

    The focusAreas property is an Array of one or more Area objects that define where the camera will perform auto-focusing.

    When set, if the array contains more objects than the number defined in CameraCapabilities.maxFocusAreas, extra objects will be ignored.

    If set to null, the camera will determine the auto-focus areas by itself.

    Area

    Area objects are arbitrary JavaScript objects which describe an area of the sensor field. They are used in the Array presented by the focusAreas property. Each object must have the following properties:

    top
    A number ranging from -1000 at the topmost of the sensor to 1000 at the bottommost of the sensor.
    left
    A number ranging from -1000 at the leftmost of the sensor to 1000 at the rightmost of the sensor.
    bottom
    A number ranging from -1000 at the topmost of the sensor to 1000 at the bottommost of the sensor.
    right
    A number ranging from -1000 at the leftmost of the sensor to 1000 at the rightmost of the sensor.
    weight
    A number defining the relative importance of the area against other areas, range from 0 to 1000.

    Note: Objects missing one or more of these properties will be ignored.

    Syntax

    var focus = instanceOfCameraControl.focusAreas

    Value

    Return an Array of one or more objects that define where the camera will perform auto-focusing.

    Example

    var options = {
      camera: navigator.mozCameras.getListOfCameras()[0]
    };
     
    function onSuccess( camera ) {
      var max = camera.capabilities.maxFocusAreas;
    
      if (max > 0) {
        camera.focusAreas = [
          {top: -500, bottom: 500, left: -500, right: 500, weight: 1000}
        ];
      }
    };
    
    navigator.mozCameras.getCamera(options, onSuccess)
    

    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

    Contributors to this page: Sheppy, MHasan, Jeremie, kscarfone, teoli, ajaybhat
    Last updated by: teoli,