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 - 25MfacingMode: By default - null 25audioBitsPerSecond: By default - 128000videoBitsPerSecond: By default - 2200000autoUpload: Start upload after recording (By default - on).uploadWhileRecording: Starting to upload while recording(by default - false)upload_urlStarting to upload while recording(by default- empty string)onInit: Function which will be called when device data will be loadedonRecord: Function which will be called during recordingonStop: Function which will be called when recording has been stopedonUploadStart: Function which will be called when uploaded started, when uploadWhileRocording is true this callback not calledonUploadCompleteFunction which will be called when upload has been completedonUploadProgress: Function which will be called while uploadingonUploadError: Function which will be called when upload will end with erroronStreamReady: 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();
- Example:
start: (Start to get camera feed) Will return created video element- Example:
recorder.start();
- Example:
record: Start to record camera feed- Example:
recorder.record();
- Example:
stop: Stop recording- Example:
recorder.stop();
- Example:
reset: Reset recording- Example:
recorder.reset();
- Example:
rerecord: Restart recording- Example:
recorder.rerecord();
- Example:
requestPermission: Request permission to use webcam and microphone- Example:
recorder.requestPermission(camera, microphone, onApprove, onDeny);
- Example:
nowRecording: Check if recording is in progress- Example:
recorder.nowRecording();
- Example:
hasWebcam: Check if webcam is available- Example:
recorder.hasWebcam();
- Example:
hasWebcamPermissions: Check if website has permission to use webcam- Example:
recorder.hasWebcamPermissions();
- Example:
hasMicrophone: Check if microphone is available- Example:
recorder.hasMicrophone();
- Example:
hasMicrophonePermissions: Check if website has permission to use microphone- Example:
recorder.hasMicrophonePermissions();
- Example:
isRecordingSupported: Check if browser supports recorder API- Example:
recorder.isRecordingSupported();
- Example:
getVideoInputs: Returning video input devices- Example:
recorder.getVideoInputs();
- Example:
getAudioInputs: Returning audio input devices- Example:
recorder.getAudioInputs();
- Example:
setVideoInput: Set video input device- Example:
recorder.setVideoInput(deviceID);
- Example:
setAudioInput: Set audio input device- Example:
recorder.setAudioInput(deviceID);
- Example:
createVideoStream: Will create stream and pass it to callback- Example:
recorder.createVideoStream(callback);
- Example:
stopVideoStream: Stop passed stream- Example:
recorder.stopVideoStream(stream);
- Example:
setUploadUrl: Set upload url- Example:
recorder.setUploadUrl(url);
- Example:
getUploader: Get uploader object- Example:
recorder.getUploader();
- Example:
update: Simply makes sure that all devices are captured and valid result is set for relevant properties.- Example:
recorder.update(callback);
- Example: