使用wx.createInnerAudioContext()播放本地音频
语音不播放,且无任何报错信息,真机调试版本可以播放,体验版和开发版不行
sayPrice: function (bgm, preVoice, price2, dollar2){
setTimeout(function () {
bgm = wx.createInnerAudioContext();
bgm.autoplay = true;
bgm.loop = false;
bgm.src = preVoice;
bgm.onPlay(function (res) {
console.log(“onPlay:”, res)
})
bgm.onError((err) => { console.log(err) })
bgm.onEnded(function () {
console.log(“播放结束1”)
let bgm2 = wx.createInnerAudioContext();
bgm2.autoplay = true;
bgm2.loop = false;
bgm2.src = ‘mp3/’ + price2 + ‘.mp3’;
bgm2.onEnded(function () {
console.log(“播放结束2”)
let bgm3 = wx.createInnerAudioContext();
bgm3.autoplay = true;
bgm3.loop = false;
bgm3.src = dollar2;
})
})
}, 150)
},
