Ian Hunter Ian Hunter - 2 months ago 37
Javascript Question

Failed to construct 'AudioContext': number of hardware contexts reached maximum

Is there a way to remove an

after I've created it?

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

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

I've tried this, but it doesn't let me create new contexts after the fact:

I am using Chrome 36 on Ubuntu Linux 14.04.


You should really only have one AudioContext in the page.

From the docs: "In most use cases, only a single AudioContext is used per document."

I can't really think of a reason why you'd ever need more than one. Is there a specific issue you've run into that caused you to create multiple contexts?