Skip to main content
Version: 3.x

Taro.getRecorderManager()

Obtains the globally unique recording manager RecorderManager.

Reference

Type

() => RecorderManager

Parameters

Sample Code

const recorderManager = Taro.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)

API Support

APIWeChat Mini-ProgramH5React Native
Taro.getRecorderManager✔️✔️