Bug 169849 - Web Audio ScriptProcessorNode pauses, emits hum after switching audio output device
Summary: Web Audio ScriptProcessorNode pauses, emits hum after switching audio output ...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Audio (show other bugs)
Version: WebKit Nightly Build
Hardware: Mac macOS 10.12
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-03-18 12:28 PDT by Brooke Vibber
Modified: 2017-03-20 06:48 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brooke Vibber 2017-03-18 12:28:09 PDT
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.
Comment 1 Radar WebKit Bug Importer 2017-03-19 13:47:25 PDT
<rdar://problem/31137513>
Comment 2 Jer Noble 2017-03-19 20:26:31 PDT
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.