CameraControl.pauseRecording()

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

Summary

The pauseRecording() method of the CameraControl interface is used to pause the recording of a video file on a Firefox OS device.

When paused, the camera remains active but audio and video frames are no longer saved to the 3gp output file. If this method is called when the camera is not recording or already paused, it fails silently.

Syntax

CameraControl.pauseRecording();

Parameters

None.

Returns

Void.

Example

This example records up to 1 GB or 1 hour of video, storing it in the standard videos store on the device. Note the use of navigator.getDeviceStorage() to determine the storage location for the video, and the pause and resume controls.

var storage = navigator.getDeviceStorage('videos');
var cameraOptions = {
  camera: navigator.mozCameras.getListOfCameras()[0]
};
var recordOptions = {
  rotation: 0,
  maxFileSizeBytes: 1024 * 1024 * 1024 // 1 GB
  maxVideoLengthMs: 1000 * 60 * 60     // 1 hour
}
function onRecordStart() {
  console.log("The device is recording the video output from the camera");
}
function onStateChange( newState ) {
  console.log("The recorder state change: " + newState);
}
function onAccessCamera( camera ) {
  camera.startRecording(recordOptions, storage, 'myVideo.3gp', onRecordStart);
  camera.onRecorderStateChange = onStateChange;
  pauseBtn.onclick = function() {
    camera.pauseRecording();
  }
  resumeBtn.onclick = function() {
    camera.resumeRecording();
  }
};
navigator.mozCameras.getCamera(cameraOptions, onAccessCamera)

Specification

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

Browser support

note that this method was added in Firefox OS 2.5.

See also

Document Tags and Contributors

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