dadadad
dadadad
  • 发布:2020-12-23 10:47
  • 更新:2020-12-23 14:38
  • 阅读:756

uni.createInnerAudioContext()多次调用导致安卓APP闪退

分类:uni-app

playSound(result) {
let fail = '/static/sounds/fail.wav';
let succes = '/static/sounds/succes.wav'
//实例化声音
const Audio = uni.createInnerAudioContext();
Audio.autoplay = true;
if (result.indexOf('成功') < 0) {
Audio.src = fail;
} else {
Audio.src = succes;
}
Audio.onError((res) => {
Audio.destroy(); //发生错误后,销毁实例
});
Audio.onPause(() => {
Audio.destroy(); //这里是播放暂停后,销毁实例
});
Audio.onStop(() => {
Audio.destroy(); //这里是播放停止后,销毁实例
});
Audio.onEnded(() => {
Audio.destroy(); //这里是播放结束后,销毁实例
})
},
//多次调用之后出现闪退问题

2020-12-23 10:47 负责人:无 分享
已邀请:
DCloud_uniCloud_JSON

DCloud_uniCloud_JSON

  • dadadad (作者)

    pad手持终端 安卓7

    2020-12-24 16:55

该问题目前已经被锁定, 无法添加新回复