webview中h5使用AudioContext播放音频时,切换底部导航栏,webview会闪退
webview中h5使用AudioContext播放音频时,切换底部导航栏,webview会闪退。如果h5内部AudioContext不是播放状态,切换底部导航就正常。目前就ios12maxPro和ios11会出现这个问题. h5相关代码如下
const audioCtx = new (AudioContext || webkitAudioContext)();
try {
audioCtx.resume();
} catch (e) {
console.log(e);
}
const source = audioCtx.createBufferSource();
this.source = source;
source.buffer = this.buffer;
source.loop = true;
source.connect(audioCtx.destination);
// Play sound
if (source.start) {
source.start(0);
} else if (source.play) {
source.play(0);
} else if (source.noteOn) {
source.noteOn(0);
}