Search code examples
javascriptweb-audio-apimicrosoft-edgeaudiocontext

How to release AudioContext in Microsoft Edge?


Is there any equivalent to AudioContext.close() for Microsoft Edge? Is there any way to release an AudioContext or is this not necessary? In Google Chrome it stops the 'recording' indicator. How does it translate in Microsoft Edge?


Solution

  • You don't "need" to release the AudioContext - it will happen as part of garbage collection. The close() was to help more advanced scenarios. In general, you can create an AudioContext and keep a reference to it until you don't need it anymore, then release the reference (e.g. "myAudioContext = null;") and it will get garbage collected in due course.