scanBtn() {
wx.scanCode({
success: (res) => {
this.voice()
},
fail: (res) => {
}
}) //wx.scanCode
},
voice: function () {
let _this=this
const innerAudioContext = wx.createInnerAudioContext()
innerAudioContext.autoplay = true
innerAudioContext.obeyMuteSwitch = false
innerAudioContext.src = "https://xcx.yearconsports.com/s.mp3"
innerAudioContext.play()
innerAudioContext.onPlay(() => {
console.log('开始播放')
})
// innerAudioContext.play();
innerAudioContext.onError((e) => {
console.log(e.errMsg)
console.log(e.errCode)
_this.voice()
})
},
上面这段代码苹果手机在【真机调试】下有声音,在【预览或发布体验版或上线】的时候没声音。为什么?
您好请问有解决方法吗?
折腾太久了,同样的问题..... 最终我是放在ONSHOW中来解决的....
麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)