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++) {
I was working on a media player widget which broke on Chrome (but not Firefox) as soon as more than five were embedded in a single page.
I discovered that you can create a single AudioContext
and store it globally, then have each instance just use the shared AudioContext
. It seems to work no differently - you can attach multiple buffers and multiple destinations and the audio all gets mixed together.
This might require more effort if you're using it for timing, but for playback of one or more audio streams generated on-the-fly with JS code, sharing a single AudioContext
works fine.