# RecorderManager
Global unique recording manager
# method
# RecorderManager.start(Object object)
Start recording.
# RecorderManager.pause()
Pause recording
# RecorderManager.resume()
Continue recording.
# RecorderManager.stop()
Stop recording.
# RecorderManager.onStart(function callback)
Start of listening recording
# RecorderManager.onResume(function callback)
Wiretaps continue the event
# RecorderManager.onPause(function callback)
Listen to Pause Event
# RecorderManager.onStop(function callback)
End of Listening Recording Event
# RecorderManager.onFrameRecorded(function callback)
Listens for file events that have finished recording the specified frame size. If you set FrameSize, the event is called back.
# RecorderManager.onError(function callback)
Listen for recording error events
# RecorderManager.onInterruptionBegin(function callback)
The listening recording was interrupted because the system was in use. The following scenarios trigger this event: WeChat voice chat, WeChat video chat. After this event is triggered, the recording is suspended. pause Event is triggered after this event
# RecorderManager.onInterruptionEnd(function callback)
Listening recording interrupt end event. Received. interruptionBegin After the event, all recordings in the Mini Program will be suspended, and only after this event can they be successfully recorded 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)