gpt4 book ai didi

javascript - 构造失败 'AudioContext' : number of hardware contexts reached maximum

转载 作者:行者123 更新时间:2023-12-02 22:40:17 25 4
gpt4 key购买 nike

有没有办法在创建 AudioContext 后将其删除?

var analyzers = [];
var contexts = [];

try {
for(var i = 0; i<20; i++) {
contexts[i] = new AudioContext();
analyzers[i] = contexts[i].createAnalyser();
}
}catch(e) {
console.log(e);
// too many contexts created -- how do I remove them?
}

我已经尝试过这个,但它不允许我在事后创建新的上下文:analyzers.forEach(function(analyzer){analyzer.disconnect(analyzer.context.destination)})

我在 Ubuntu Linux 14.04 上使用 Chrome 36。

最佳答案

AudioContext.close() 将释放上下文的硬件,但请检查它是否仅适用于最新版本的 chrome 和 firefox。显然不适用于 IE。检查文档: https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/close

关于javascript - 构造失败 'AudioContext' : number of hardware contexts reached maximum,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25046470/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com