Start the video recorder application and return information about captured video clip files.

    CaptureCB captureSuccess, CaptureErrorCB captureError, [CaptureVideoOptions options]


Starts an asynchronous operation to capture video recordings using the device's video recording application. The operation allows the user to capture more than one recordings in a single session.

The capture operation ends when either the user exits the video recording application, or the maximum number of recordings specified by [CaptureVideoOptions](captureVideoOptions.html).limit is reached. If no limit parameter value is specified, it defaults to one (1), and the capture operation terminates after the user records a single video clip.

When the capture operation finishes, it the [CaptureCB](CaptureCB.html) callback executes with an array of [MediaFile](MediaFile.html) objects describing each captured video clip file. If the user terminates the operation before capturing a video clip, the [CaptureErrorCB](CaptureErrorCB.html) callback executes with a [CaptureError](CaptureError.html) object featuring a [CaptureError](CaptureError.html).CAPTURE_NO_MEDIA_FILES error code.

Supported Platforms

  • Amazon Fire OS
  • Android
  • BlackBerry 10
  • iOS
  • Windows Phone 7 and 8
  • Windows 8

Quick Example

// capture callback
var captureSuccess = function(mediaFiles) {
    var i, path, len;
    for (i = 0, len = mediaFiles.length; i < len; i += 1) {
        path = mediaFiles[i].fullPath;
        // do something interesting with the file

// capture error callback
var captureError = function(error) {
    navigator.notification.alert('Error code: ' + error.code, null, 'Capture Error');

// start video capture
navigator.device.capture.captureVideo(captureSuccess, captureError, {limit:2});

Full Example

<!DOCTYPE html>
    <title>Capture Video</title>

    <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
    <script type="text/javascript" charset="utf-8" src="json2.js"></script>
    <script type="text/javascript" charset="utf-8">

    // Called when capture operation is finished
    function captureSuccess(mediaFiles) {
        var i, len;
        for (i = 0, len = mediaFiles.length; i < len; i += 1) {

    // Called if something bad happens.
    function captureError(error) {
        var msg = 'An error occurred during capture: ' + error.code;
        navigator.notification.alert(msg, null, 'Uh oh!');

    // A button will call this function
    function captureVideo() {
        // Launch device video recording application,
        // allowing user to capture up to 2 video clips
        navigator.device.capture.captureVideo(captureSuccess, captureError, {limit: 2});

    // Upload files to server
    function uploadFile(mediaFile) {
        var ft = new FileTransfer(),
            path = mediaFile.fullPath,
            name =;

            function(result) {
                console.log('Upload success: ' + result.responseCode);
                console.log(result.bytesSent + ' bytes sent');
            function(error) {
                console.log('Error uploading file ' + path + ': ' + error.code);
            { fileName: name });

        <button onclick="captureVideo();">Capture Video</button> <br>

BlackBerry 10 Quirks

  • Cordova for BlackBerry 10 attempts to launch the Video Recorder application, provided by RIM, to capture video recordings. The app receives a [CaptureError](CaptureError.html).CAPTURE_NOT_SUPPORTED error code if the application is not installed on the device.