SIGN UP

Recorder

Recorder module lets developers record audio from sources such as Call, Conference, Player. If audio is sent to the Recorder instance from multiple sources it will be mixed automatically. Please note that module could only record an audio. For video recording use the Call.record({video: true}) method call. Audio records are saved in form of mp3 files. The quality properties can be set in the RecorderParameters.hd_audio parameter; if not specified, the default quality is 8kHz / 32kbps. The files are accessible via HTTP(S) using URLs that can be received from call logs or by using the GetCallHistory method of HTTP API.

Add the following line to your scenario code to use the module:

require(Modules.Recorder);

All functions, events and classes of the module can be used only after this statement.

Usage example:

require(Modules.Recorder);
VoxEngine.addEventListener(AppEvents.CallAlerting, e => {
  const call = e.call;
  const recorder = VoxEngine.createRecorder();
  recorder.addEventListener(RecorderEvents.Started, e => {
    // Recording URL is available as 'e.url'
  });
  call.addEventListener(CallEvents.Connected, e => {
    call.sendMediaTo(recorder); // Start call recording
    // Stop recording after 5 seconds
    setTimeout(() => {recorder.stop();}, 5000);
  });
  call.answer();
});

functions

VoxEngine.createRecorder

VoxEngine.createRecorder(options: RecorderParameters): Recorder

Create new audio recorder. Sources can later be attached using the Call.sendMediaTo method.

Parameters

  • Optional

    Object with recorder parameters. Note that if the first parameter is not an object, it's treated as 'name', with second optional parameter as 'secure' boolean flag, default to 'false'.

Returns

Examples

request:

Minimal example:

 require(Modules.Recorder);
 var recorder = VoxEngine.createRecorder(); // create Recorder instance

Example with parameters:

 require(Modules.Recorder);
 var recorder = VoxEngine.createRecorder({stereo: true, lossless: true});