Path: blob/main/files/en-us/web/api/audiocontext/sinkchange_event/index.md
6552 views
------{{APIRef("Web Audio API")}}{{SeeCompatTable}}
The sinkchange event of the {{domxref("AudioContext")}} interface is fired when the output audio device (and therefore, the {{domxref("AudioContext.sinkId")}}) has changed.
Syntax
Use the event name in methods like {{domxref("EventTarget.addEventListener", "addEventListener()")}}, or set an event handler property.
Event type
{{domxref("Event")}}.
{{InheritanceDiagram("Event")}}
Examples
A sinkchange event listener can be used to report a change of audio output device. Note that if {{domxref("AudioContext.sinkId", "sinkId")}} contains an {{domxref("AudioSinkInfo")}} object, it indicates that the audio has been changed to not play on any output device.
See our SetSinkId test example for working code.
Specifications
{{Specifications}}
Browser compatibility
{{Compat}}
See also
{{domxref("AudioContext.setSinkId()")}}
{{domxref("AudioContext.sinkId")}}