Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

CameraControl.setConfiguration()

This article needs a technical review. How you can help.

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

Summary

This method is used to set the camera configuration independently of the CameraManager.getCamera() call.

Syntax

CameraControl.setConfiguration(cameraConfiguration);

Parameters

cameraConfiguration
An object allowing you to set camera options for this camera: mode, previewSize and recorderProfile.

Return Value

This method returns a Promise.

Example

var initialOptions = {
	mode: 'picture'
};

var camera = navigator.mozCameras.getListOfCameras()[0];

navigator.mozCameras.getCamera( camera, initialOptions ).then(
	function success( cameraControl ) {
		var modifiedOptions = {
			mode: 'picture',
			recorderProfile: 'jpg',
			previewSize: {
				width: 352,
				height: 288
			}
		};
		
		cameraControl.setConfiguration( modifiedOptions ).then(
			function success( config ) {
			},
			function error ( err ) {
			}
		);
	},
	function error ( err ) {
	}
);

Specification

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

Document Tags and Contributors

 Contributors to this page: chrisdavidmills, rolfedh, Cfinke
 Last updated by: chrisdavidmills,