mozilla
Your Search Results

    CameraControl.setExposureCompensation()

    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 privileged or certified applications only.

    Summary

    This method is used to change the exposure compensation value.

    Acceptable values for the exposure compensation range from the CameraCapabilities.minExposureCompensation value to the CameraCapabilities.maxExposureCompensation value in steps equal to the value of CameraCapabilities.stepExposureCompensation; invalid values will be rounded to the nearest valid value.

    Syntax

    CameraControl.setExposureCompensation([compensation]);

    Parameters

    compensation Optional
    The new value for the exposure compensation. This parameter is optional; if it's missing, the camera will use automatic exposure compensation.

    Example

    This example gets the first camera and sets the exposure compensation to the middle of the allowed range.

    var options  = {
      camera: navigator.mozCameras.getListOfCameras()[0]
    };
     
    function onAccessCamera( camera ) {
      var min  = camera.capabilities.minExposureCompensation;
      var max  = camera.capabilities.maxExposureCompensation;
      var step = camera.capabilities.stepExposureCompensation;
    
      var mid  = Math.round((max - min) / step / 2) * step;
    
      camera.setExposureCompensation(mid);
    };
     
    navigator.mozCameras.getCamera(options, onAccessCamera);
    

    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, Jeremie, chrisdavidmills, kscarfone, teoli, ajaybhat
    Last updated by: chrisdavidmills,