Chrome Extension webAudio API stops Windows power saving modes
<p>I have a problem with a chrome extension. The extension creates an audioContext which connects to a <code>&lt;audio&gt;</code> tag on a background page using the following code. On audio end <code>onClick()</code> the kill function is called. </p>

<p>When playing I see (expected) <code>[DRIVER] High Definition Audio Device (HDAUDIO\FUNC_01&amp;VEN_111D&amp;DEV_76D5&amp;SUBSYS_1028040A&amp;REV_1001\4&amp;143c5ca7&amp;0&amp;0001)
An audio stream is currently in use.</code> when performing <code>powercfg -requests</code> on a windows system. However when calling the kill function, I still see the same driver in use message and the machine will not suspend/sleep/hibernate. </p>

<p>When inspecting the background page, the variables listed - all that are related to audio - are all undefined. The only cure I've found so far is to reload the background page - a superhack and I despise everything it stands for. </p>

<p>Anyone with similar experiences or a knowledge of the chrome webaudio API inner demons?</p>

<p>Point of note:
The variables are global in the context of the demo code. In the live code these are local scope.</p>

<p>Cheers, 
Phil.</p>

<pre><code>function kill_audio_context(){
    capAudio.remove();
    capAudio = undefined;
    try{
        analyser.disconnect();
        source.disconnect();
        audioContext = undefined;
        source=undefined; 
        analyser=undefined;
    }catch(e){console.log(e)} 
    // No errors, except expected when no audio element exists (first load)

    // KILL IT WITH FIRE!!
    //chrome.runtime.reload();
}
function load_audio_context(){
    audioContext = new AudioContext();
    analyser = audioContext.createAnalyser();
    analyser.fftSize = 2048;
    source = audioContext.createMediaElementSource(capAudio);
    source.connect(analyser);
    analyser.connect(audioContext.destination);
}
</code></pre>