Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

Is there a way to remove an AudioContext 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) {    console.log(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: analyzers.forEach(function(analyzer){analyzer.disconnect(analyzer.context.destination)})

I am using Chrome 36 on Ubuntu Linux 14.04.

like image 802
Ian Hunter Avatar asked Jul 30 '14 20:07

Ian Hunter


1 Answers

AudioContext.close() will release the hardware of the context, but check that it is available only for recent versions of chrome and firefox. Not available for IE aparently. Check the documentation: https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/close

like image 189
Julian Avatar answered Oct 14 '22 11:10

Julian