const recorderManager = wx.getRecorderManager()
recorderManager.onStart(() => {
console.log('recorder start')
})
recorderManager.onResume(() => {
console.log('recorder resume')
})
recorderManager.onPause(() => {
console.log('recorder pause')
})
recorderManager.onStop((res) => {
console.log('recorder stop', res)
const { tempFilePath } = res
wx.playVoice({
filePath: tempFilePath,
fail:function(ret){
console.log(ret)
},
success:function(){
console.log('播放成功')
}
})
})
recorderManager.onFrameRecorded((res) => {
const { frameBuffer } = res
console.log('frameBuffer.byteLength', frameBuffer.byteLength)
})
const options = {
duration: 5000,
sampleRate: 44100,
numberOfChannels: 1,
encodeBitRate: 192000,
format: 'mp3',
frameSize: 50
}
recorderManager.start(options)
我的手机是一加3T,微信版本是6.5.16版本
你好,使用 getRecorderManager 录制的音频,需要使用 createInnerAudioContext 接口来播放 https://mp.weixin.qq.com/debug/wxadoc/dev/api/createInnerAudioContext.html