• 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.pauseRecording()

CameraControl.pauseRecording()

In This Article
  1. Summary
  2. Syntax
    1. Parameters
    2. Returns
  3. Example
  4. Specification
  5. Browser support
  6. See also

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

  • CameraControl
  • CameraControl.resumeRecording()
  • CameraControl.stopRecording()
  • The DeviceStorage API

Document Tags and Contributors

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