Version: 2.2.1

Taro.getRecorderManager()

获取全局唯一的录音管理器 RecorderManager

参考文档

类型

() => RecorderManager

参数

示例代码

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 支持度

API微信小程序H5React Native
Taro.getRecorderManager✔️