RecorderManager
Introduction
The global unique recorder manager.
Methods
RecorderManager.start(Object object)
Starts recording.
RecorderManager.stop()
Stops recording.
RecorderManager.pause()
Pauses recording.
RecorderManager.resume()
Resumes recording.
RecorderManager.onStart(function listener)
Listens for the start of recording event.
RecorderManager.offStart(function listener)
Unsubscribes from the start of recording event.
RecorderManager.onPause(function listener)
Listens for the pause of recording event.
RecorderManager.offPause(function listener)
Unsubscribes from the pause of recording event.
RecorderManager.onResume(function listener)
Listens for the resume of recording event.
RecorderManager.offResume(function listener)
Unsubscribes from the resume of recording event.
RecorderManager.onStop(function listener)
Listens for the end of recording event.
RecorderManager.offStop(function listener)
Unsubscribes from the end of recording event.
RecorderManager.onError(function listener)
Listens for recording error events.
RecorderManager.offError(function listener)
Unsubscribes from recording error events.
Example
// pages/index/index.js
const recorderManager = dlt.getRecorderManager();
recorderManager.onStart(() => {
console.log('Recorder started');
});
recorderManager.onPause(() => {
console.log('Recorder paused');
});
recorderManager.onStop((res) => {
console.log('Recorder stopped', res);
const { tempFilePath } = res;
});
const options = {
duration: 10000,
sampleRate: 44100,
numberOfChannels: 1,
encodeBitRate: 192000,
format: 'aac',
};
recorderManager.start(options);
In this example, the RecorderManager
is used to manage the recording process. Event listeners are set up to listen for various recording events, such as start, pause, and stop. The start
method is then called to begin recording with specified options.