• Skip to main content
  • Select language
  • Skip to search
MDN Web Docs
  • Technologies
    • HTML
    • CSS
    • JavaScript
    • Graphics
    • HTTP
    • APIs / DOM
    • WebExtensions
    • MathML
  • References & Guides
    • Learn web development
    • Tutorials
    • References
    • Developer Guides
    • Accessibility
    • Game development
    • ...more docs
B2G OS
  1. MDN
  2. Archive of obsolete content
  3. B2G OS
  4. B2G OS APIs
  5. CameraControl
  6. CameraControl.setConfiguration()

CameraControl.setConfiguration()

In This Article
  1. Summary
  2. Syntax
    1. Parameters
    2. Return Value
  3. Example
  4. Specification

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

Tags: 
  • API
  • DOM
  • DOM Reference
  • Firefox OS
  • Graphics
  • Method
  • Non Standard
  • Reference
 Contributors to this page: chrisdavidmills, rolfedh, Cfinke
 Last updated by: chrisdavidmills, Feb 27, 2017, 2:07:28 AM
See also
  1. Camera API
  2. Archive
  3. Related pages for Camera API
    1. CameraCapabilities
    2. CameraControl
    3. CameraManager