语音不播放,且无任何报错信息,真机调试版本可以播放,体验版和开发版不行
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)
},
微信小程序开发问题解答
微信小程序开发者回答:
麻烦提供出现问题的机型和微信版本,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
本文网址:http://www.91bianli.com/weixinxiaochengxu/23301.html