diff --git a/src/useAudioContext.tsx b/src/useAudioContext.tsx index 0ed2abb3..a5f7436c 100644 --- a/src/useAudioContext.tsx +++ b/src/useAudioContext.tsx @@ -110,7 +110,11 @@ export function useAudioContext( // Update the sink ID whenever we change devices. useEffect(() => { - if (audioContext && "setSinkId" in audioContext) { + if ( + audioContext && + "setSinkId" in audioContext && + audioOutput.selectedWebDeviceId + ) { // https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/setSinkId // @ts-expect-error - setSinkId doesn't exist yet in types, maybe because it's not supported everywhere. audioContext.setSinkId(audioOutput.selectedWebDeviceId).catch((ex) => {