使用wx.createInnerAudioContext()播放本地音频
发布于 6 年前 作者 yongzhu 8540 次浏览 来自 问答

语音不播放,且无任何报错信息,真机调试版本可以播放,体验版和开发版不行

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)

},

2 回复

麻烦提供出现问题的机型和微信版本,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

求各路神仙帮帮忙

回到顶部