Your Search Results


    This feature is not on a current W3C standards track, but it is supported on the Firefox OS platform. Although implementations may change in the future and it is not supported widely across browsers, it is suitable for use in code dedicated to Firefox OS apps.

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


    This method is used to start recording a video file on the device; the video is stored as a 3gp file.

    Note: Before calling this method, you must call CameraControl.getPreviewStreamVideoMode(); if you don't, this method will fail.

    Once the recorder starts running, its state can change asynchronously based on the limits set when you called startRecording(); see Options below. To monitor and react to those changes, you can use the CameraControl.onRecorderStateChange property to define a custom callback function.


    CameraControl.startRecording(options, storage, filename, onsuccess[, onerror]);


    An object specifying options for the video capture operation; see Options below.
    An object of type DeviceStorage that defines where to store the output file.
    The name of the output file.
    A callback function that is called once the recording has began.
    onerror Optional
    A callback function that accepts an error string as parameter.


    The options object passed to this method has the following properties:

    rotation Optional
    The degrees clockwise to rotate the recorded video; if this option is not supported by the device, it will be ignored; if this option is missing, the default is 0.
    maxFileSizeBytes Optional
    The maximum size in bytes to which the recorded video file will be allowed to grow. If this option is missing, zero, or negative no size limit will be applied (up to the physical limits of the device).
    maxVideoLengthMs Optional
    The maximum length in milliseconds to which the recorded video will be allowed to grow. If this option is missing, zero, or negative no size limit will be applied up to the physical limits of the device.


    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.

    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;
    navigator.mozCameras.getCamera(cameraOptions, onAccessCamera)


    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: chrisdavidmills,