We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

CameraControl.setExposureCompensation Redirect 1

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 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.




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


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;

navigator.mozCameras.getCamera(options, onAccessCamera);


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,