我不知道算不算BUG,我在页面中
recorderManager.onStop((res) => {
console.log(‘recorder stop’, res)
const { duration, tempFilePath } = res
const durTxt = dur2text(duration)
sendVoiceFile(this, tempFilePath, durTxt, duration)
this.reset()
})
调用了录音,返回了“wxfile://…………”的临时文件,在页面没有关闭的时候,在组件内调用
wx.playVoice({
filePath: path,
duration: dur,
success: (e) => {
console.log(‘play’, e)
this.setData({
isPlaying: !this.data.isPlaying
})
},
fail: (e) => {
console.log(‘fail’, e)
}
})就会播放失败