The entry point for the recorder SDK is the
This interface provides functions to:
- start and stop the recording
- control the camera through
- configure the upload
- preview the recorded video
- build a responsive UI to show controls to the user.
The recorder will also forward all relevant events to subscribers that were registered with the
addListener* functions. We recommend listening at least to the result and error event:
We provide different implementations that can be used within your app depending on your needs, but all of them share the same API surface described below. All of them will also automatically request the appropriate permissions: camera, microphone and, in some cases, storage.
Note: if you use the default controls, the user will be able to control the recorder through the user interface, so there's no need to interact directly with these functions.
The recorder is able to record multiple clips together in a single file. This means that recording can be paused and resumed as many times as you want. To start recording:
This will soon move the
To pause recording:
This will bring back
RecorderState.IDLE. At this point, the video is not finalized,
and you have different options:
- resume recording, with
- confirm the video, with
- discard the video, with
- enter or exit preview mode
The recorder can go through multiple
pause() calls and the new video will
just be appended to the existing content. You can also change camera sensor and settings in between.
As you record clips with
pause(), the recorder will expose information about
the recorded data with
When multiple clips are recorded (through multiple start / pause cycles), we offer the option to seamlessly remove the last clip - as many modern apps do - without losing the previous segments.
If the recorder only has 1 clip, calling
removeLastClip has the same effect of canceling the video.
To discard the recorded data (assuming it was not confirmed yet), simply call
reset(). This will
move the recorder to its original state, with no pending record and zero clips:
To confirm the recorded data (be it 1 or multiple clips), simply call
confirm(). This tells
the recorder that you are not planning to write anything else to this file.
The recorder has an option to stop recording automatically after a certain duration has been
reached. This duration can be set through
recorder.maxDuration in milliseconds:
You have the option to import videos from the gallery using the
In both cases, the recorder will enter preview mode to preview the video.