The videorecorder object allows you to customize how a video should be made with the camera

All the methods of the videorecorder object (except the startVideoRecorder method) are chainable to make its configuration pretty intuitive. But it's already made to work without any configuration (only the callbacks):

OurCodeWorld.MaterialCamera.videoRecorder.startVideoRecorder({
    success: function(e){
        console.log(e);
    },
    error: function(e){
        console.error(e);
    },
    none: function(){
        console.log("The user didn't record a video");
    }
});

See the list of all the available methods:

allowRetry

The allow retry method expects as first parameter a boolean that specifies whether or not the 'Retry' button is visible once a picture is made.

OurCodeWorld.MaterialCamera.videoRecorder
    .allowRetry(true)
    .startVideoRecorder({
        success: function(e){
            console.log(e);
        }
    });

autoSubmit

The auto submit method specifies wheter once the picture is made, the camera will automatically close and send the result.

OurCodeWorld.MaterialCamera.videoRecorder
    .autoSubmit(true)
    .startVideoRecorder({
        success: function(e){
            console.log(e);
        }
    });

saveDir

The save dir method expects as first parameter the local path where the picture should be saved (as default the plugin stores the image in the cache folder of your app):

OurCodeWorld.MaterialCamera.videoRecorder
    .saveDir("/storage/emulated/0/")
    .startVideoRecorder({
        success: function(e){
            console.log(e);
        }
    });

defaultToFrontFacing

This method expects as first parameter a boolean that indicates wheter the frontal camera should be used as first or not.

OurCodeWorld.MaterialCamera.videoRecorder
    .defaultToFrontFacing(true)
    .startVideoRecorder({
        success: function(e){
            console.log(e);
        }
    });

retryExits

This method specifies if the the 'Retry' button in the playback screen will exit the camera instead of going back to the recorder.

OurCodeWorld.MaterialCamera.videoRecorder
    .retryExits(true)
    .startVideoRecorder({
        success: function(e){
            console.log(e);
        }
    });

maxAllowedFileSize

Sets a max file size for the camera. Keep in mind, the FAT file system has a file size limit of 4GB.

OurCodeWorld.MaterialCamera.videoRecorder
    .maxAllowedFileSize(1024 * 1024 * 50) // max 50MB
    .startVideoRecorder({
        success: function(e){
            console.log(e);
        }
    });

qualityProfile

This method expects a string with the identifier of quality for the camera:

Mode
QUALITY_1080P
QUALITY_720P
QUALITY_480P
QUALITY_HIGH
QUALITY_LOW
OurCodeWorld.MaterialCamera.videoRecorder
    .qualityProfile("QUALITY_1080P")
    .startVideoRecorder({
        success: function(e){
            console.log(e);
        }
    });

setLanguage

The setLanguage method expects a string with the language code that will be used for the camera:

Better translation and more languages required

If your language is not here, you can add it easily if you modify the strings resource of the plugin. Any pull request with new languages to the repository is welcome.

Flag Description Codes for initialization
Supported language English (USA)
English (Great Britain) Great Britain 
United States of America
en
Supported language Español es
Supported language Deutsch de
Supported language Italiano it
Supported language Français fr
Supported language Japanese 日本人 jp
Supported language Russian ru
Supported language Portugues pt
OurCodeWorld.MaterialCamera.videoRecorder
    .setLanguage("es")// Set the buttons to Spanish
    .startVideoRecorder({
        success: function(e){
            console.log(e);
        }
    });

startVideoRecorder

The start video recorder method will start the camera with all the providen configuration. It expects as first parameter an object with 3 callbacks:

Callback Description
success Triggered when the image was succesfully created. It receives as first argument an object with the outputFile property that has the path where the video was created.
error Callback triggered when a catchable error occurs. It receives as argument a variable with information about the error
none This callback is triggered when the user started the camera but no video was submitted.
OurCodeWorld.MaterialCamera.videoRecorder
    .startVideoRecorder({
        success: function(Data){
            console.info(Data);
            // { mode:"video"
            // outputFile: "file:///storage/emulated/0/Android/data/com.ourcodeworld.sandbox/cache/VID_20170201_125644.mp4"
            // status: "success"}
        },
        error: function(err){
            console.error(Data);
        },
        none: function(){
            console.log("The user started the camera, but didn't do anything :) ");
        }
    });

showPortraitWarning

This method expects as first parameter a boolean that specifies whether or not a warning is displayed if the user presses record in portrait orientation:

OurCodeWorld.MaterialCamera.videoRecorder
    .showPortraitWarning(true)
    .startVideoRecorder({
        success: function(Data){
            console.info(Data);
        }
    });

restartTimerOnRetry

If true, the countdown timer is reset to 0 when the user taps 'Retry' in playback (in case there's a timer):

OurCodeWorld.MaterialCamera.videoRecorder
    .restartTimerOnRetry(true)
    .startVideoRecorder({
        success: function(Data){
            console.info(Data);
        }
    });

autoRecordWithDelaySec

This method expects an integer as first argument that specifies that the video camera will start recording automatically after a 5 second countdown. This disables switching between the front and back camera initially:

OurCodeWorld.MaterialCamera.videoRecorder
    .autoRecordWithDelaySec(5)
    .startVideoRecorder({
        success: function(Data){
            console.info(Data);
        }
    });

autoRecordWithDelayMs

This method does the same as the above, however expressed with milliseconds instead of seconds:

OurCodeWorld.MaterialCamera.videoRecorder
    .autoRecordWithDelayMs(5000)
    .startVideoRecorder({
        success: function(Data){
            console.info(Data);
        }
    });

audioDisabled

This method expects a boolean as first argument that specifies wheter the audio for the video should be disabled or not:

OurCodeWorld.MaterialCamera.videoRecorder
    .audioDisabled(true)
    .startVideoRecorder({
        success: function(Data){
            console.info(Data);
        }
    });

continueTimerInPlayback

If true, the countdown timer will continue to go down during playback, rather than pausing:

OurCodeWorld.MaterialCamera.videoRecorder
    .continueTimerInPlayback(true)
    .startVideoRecorder({
        success: function(Data){
            console.info(Data);
        }
    });

videoEncodingBitRate

Sets a custom bit rate for video recording.

OurCodeWorld.MaterialCamera.videoRecorder
    .videoEncodingBitRate(1024000)
    .startVideoRecorder({
        success: function(Data){
            console.info(Data);
        }
    });

audioEncodingBitRate

Sets a custom bit rate for audio recording.

OurCodeWorld.MaterialCamera.videoRecorder
    .audioEncodingBitRate(50000)
    .startVideoRecorder({
        success: function(Data){
            console.info(Data);
        }
    });

videoFrameRate

Sets a custom frame rate (FPS) for video recording:

OurCodeWorld.MaterialCamera.videoRecorder
    .videoFrameRate(24)
    .startVideoRecorder({
        success: function(Data){
            console.info(Data);
        }
    });

videoPreferredHeight

Sets a preferred height for the recorded video output:

OurCodeWorld.MaterialCamera.videoRecorder
    .videoPreferredHeight(720)
    .startVideoRecorder({
        success: function(Data){
            console.info(Data);
        }
    });

videoPreferredAspect

Sets a preferred aspect ratio for the recorded video output:

OurCodeWorld.MaterialCamera.videoRecorder
    .videoPreferredAspect(4 / 3)
    .startVideoRecorder({
        success: function(Data){
            console.info(Data);
        }
    });