Skip to content
Last updated

cpRecordAPI

Gives developers full programmatic control over video recording using the user's webcam and microphone.

Include the Script

<script type="text/javascript" src="//wwwcdn.cincopa.com/_cms/ugc/recorder.js"></script>

Initialize the Recorder

var recorder = new cpRecordAPI(options);recorder.activate(); 

cpRecordAPI has just 1 argument

Parameters

  • options: An object of options for initial setup:
    • resolution: Set video resolution.
    • aspectRatio: Set the aspect ratio for recording.
    • resolution: The resolution of recorded video (by default - 480).
    • aspectRatio: The aspect ratio of video (by default - 16/9).
    • microphone: Enable Voice Recording Option (by default - true).
    • frameRate: By default - 25M
    • facingMode: By default - null 25
    • audioBitsPerSecond: By default - 128000
    • videoBitsPerSecond: By default - 2200000
    • autoUpload: Start upload after recording (By default - on).
    • uploadWhileRecording: Starting to upload while recording(by default - false)
    • upload_url Starting to upload while recording(by default- empty string)
    • onInit: Function which will be called when device data will be loaded
    • onRecord: Function which will be called during recording
    • onStop: Function which will be called when recording has been stoped
    • onUploadStart: Function which will be called when uploaded started, when uploadWhileRocording is true this callback not called
    • onUploadComplete Function which will be called when upload has been completed
    • onUploadProgress: Function which will be called while uploading
    • onUploadError: Function which will be called when upload will end with error
    • onStreamReady: Function which will be called when stream will be ready

Callable Methods

There are several callable methods that you can use to execute certain predefined functions. The following are the allowed callable methods:

  • activate: activate recorder

    • Example: recorder.activate();
  • start: (Start to get camera feed) Will return created video element

    • Example:recorder.start();
  • record: Start to record camera feed

    • Example: recorder.record();
  • stop: Stop recording

    • Example: recorder.stop();
  • reset: Reset recording

    • Example: recorder.reset();
  • rerecord: Restart recording

    • Example: recorder.rerecord();
  • requestPermission: Request permission to use webcam and microphone

    • Example:recorder.requestPermission(camera, microphone, onApprove, onDeny);
  • nowRecording: Check if recording is in progress

    • Example: recorder.nowRecording();
  • hasWebcam: Check if webcam is available

    • Example: recorder.hasWebcam();
  • hasWebcamPermissions: Check if website has permission to use webcam

    • Example: recorder.hasWebcamPermissions();
  • hasMicrophone: Check if microphone is available

    • Example: recorder.hasMicrophone();
  • hasMicrophonePermissions: Check if website has permission to use microphone

    • Example: recorder.hasMicrophonePermissions();
  • isRecordingSupported: Check if browser supports recorder API

    • Example: recorder.isRecordingSupported();
  • getVideoInputs: Returning video input devices

    • Example: recorder.getVideoInputs();
  • getAudioInputs: Returning audio input devices

    • Example: recorder.getAudioInputs();
  • setVideoInput: Set video input device

    • Example: recorder.setVideoInput(deviceID);
  • setAudioInput: Set audio input device

    • Example: recorder.setAudioInput(deviceID);
  • createVideoStream: Will create stream and pass it to callback

    • Example: recorder.createVideoStream(callback);
  • stopVideoStream: Stop passed stream

    • Example: recorder.stopVideoStream(stream);
  • setUploadUrl: Set upload url

    • Example: recorder.setUploadUrl(url);
  • getUploader: Get uploader object

    • Example: recorder.getUploader();
  • update: Simply makes sure that all devices are captured and valid result is set for relevant properties.

    • Example: recorder.update(callback);