CameraControl.setConfiguration()

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

JavaScript
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

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

License

© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/cameracontrol/setconfiguration

API DOM DOM Reference Firefox OS Graphics Method Reference