# RecorderManager
The globally unique recording manager.
# Methods
# RecorderManager.start(Object object)
Starts recording
# RecorderManager.pause()
Pauses recording
# RecorderManager.resume()
Resumes recording
# RecorderManager.stop()
Stops recording
# RecorderManager.onStart(function callback)
Listens on the event that recording starts.
# RecorderManager.onResume(function callback)
Listens on the event that recording resumes.
# RecorderManager.onPause(function callback)
Listens on the event that recording pauses.
# RecorderManager.onStop(function callback)
Listens on the event that recording ends.
# RecorderManager.onFrameRecorded(function callback)
Listens on the event that the file with specified frame size has been recorded. This event is called back if frameSize is set.
# RecorderManager.onError(function callback)
Listens on the recording error event.
# RecorderManager.onInterruptionBegin(function callback)
Listens on the event that recording interruption starts due to system occupation. This event is triggered by the following scenarios: WeChat voice chat and WeChat video chat. After this event is triggered, the recording is paused. The pause event is triggered after this event.
# RecorderManager.onInterruptionEnd(function callback)
Listens on the event that recording interruption ends. After the interruptionBegin event is received, all recording in the Mini Program is paused. After this event is received, recording can be started again.
# Sample Code
const recorderManager = wx.getRecorderManager()
recorderManager.onStart(() => {
console.log('recorder start')
})
recorderManager.onPause(() => {
console.log('recorder pause')
})
recorderManager.onStop((res) => {
console.log('recorder stop', res)
const { tempFilePath } = res
})
recorderManager.onFrameRecorded((res) => {
const { frameBuffer } = res
console.log('frameBuffer.byteLength', frameBuffer.byteLength)
})
const options = {
duration: 10000,
sampleRate: 44100,
numberOfChannels: 1,
encodeBitRate: 192000,
format: 'aac',
frameSize: 50
}
recorderManager.start(options)