https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/sinkchange_event
AudioContext: sinkchange event - Web APIs | MDN
The sinkchange event of the AudioContext interface is fired when the output audio device (and therefore, the AudioContext.sinkId) has changed.
event webaudiocontextapismdn