wx.downloadFile({
url:“http://123.206.192.155/files/music/341_002_01.mp3”,
success:function(res){
wx.playVoice({
filePath: res.tempFilePath,
success:function(e){
console.log(res.tempFilePath)
console.log(e)
},
fail: function () {
console.log(“播放失败”)
}
})
}
})
这是代码
日志:
{tempFilePath: “wxfile://tmp_250646293o6zAJs779AehKefPJq2Gl_1PFov498d192d8a1f33a9e337274a935febea6.mp3”, statusCode: 200, errMsg: “downloadFile:ok”}
lesson1.js? [sm]:110 {errMsg: “playVoice:ok”}
都是ok的,就是没声音,有大神来解答下
1.播放录音的话得用真机
2.用
wx.createInnerAudioContext()
替代:wx.playVoice
https://developers.weixin.qq.com/miniprogram/dev/api/createInnerAudioContext.html