setOutputDeviceAsync()

setOutputDeviceAsync({ outputDeviceId })

Compatibility:
Prebuilt
Custom

Sets the output device. Takes a device ID argument that matches an ID returned by enumerateDevices().

Returns a Promise which resolves with an object containing device info:

Browser support

Firefox versions <116 and Safari versions <18.4 do not support setSinkId or listing audio output devices as part of enumeration and therefore cannot use setOutputDeviceAsync(). On browsers that do not report output devices as part of enumerateDevices(), we recommend simply listing the device as "Default" and hiding UI meant for changing the speaker. Note: setOutputDeviceAsync() will not throw an error for these browsers, but it will log that the command cannot be performed and return the device list with speaker set to {}.

Safari 18.4 is the first version to introduce speaker selection support. However, it is our experience that it does not work reliably. Current releases of Safari Technology Preview indicate that these issues will be resolved and this appears to be the case in our testing. If a user encounters audio issues after switching speaker devices, we recommend trying another browser or refreshing the page.