We're using Web Audio's ScriptProcessorNode to play audio files that have been decoded in JavaScript dynamically; it works quite well except when the audio output device is changed during playback. On my MacBook Pro running macOS 10.12.3, I can reproduce this by plugging or unplugging a USB speaker during playback; both directions produce similar results: * audio stops on the old device * on the new device, a humming noise may be emitted * audioprocessing events are no longer delivered When switching back to the original output device, audioprocessing events continue being delivered, and audio continues as expected. Simplified test case: https://brionv.com/misc/audio.html Same results with Safari 10 release version, Technical Preview, and WebKit Nightly.
<rdar://problem/31137513>
This sounds suspiciously like a bug we fixed in iOS last year; I must have done it in a platform specific area of the Web Audio code. Should be relatively easy to port over.