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


Releases the camera so that other applications can use it. You should call this whenever the camera is not actively being used by your application.

Warning: If you fail to call this method, other applications will never be able to access the camera.

After calling this method, your CameraControl object is defunct; you will need to call CameraManager.getCamera() to get a new one if you want to use the camera again.


CameraControl.release([onsuccess[, onerror]]);


onsuccess Optional
A callback function which is called once the hardware has actually been released.
onerror Optional
A callback function that accepts an error string; this is called if an error occurs while releasing the camera.

Note: Both callbacks are optional; unless you really need to know when the hardware has actually been released for use by other applications, you probably won't need to use them.


This example sets up an unload event handler that will automatically release the camera when the document is unloaded (such as when the app exits).

var myCamera = null;
var options  = {
  camera: navigator.mozCameras.getListOfCameras()[0]

function onAccessCamera( camera ) {
  myCamera = camera;

  console.log("The camera is now used by this Apps")

function onReleasedCamera() {
  console.log("The camera is now free to be used by another Apps");

function releaseCamera() {
  if (myCamera) {

navigator.mozCameras.getCamera(options, onAccessCamera);

window.addEventListener('unload', releaseCamera);


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,