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)
})
},
苹果手机在真机调试下有声音,在预览或体验版或上线就没声音。