> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes. # setMediaElementSinkId > setMediaElementSinkId function in the WebRTC namespace. ### setMediaElementSinkId * `Const` **setMediaElementSinkId**(`el`, `deviceId`): `Promise` Assigns the specified audio output device to the specified `HTMLMediaElement`. The device with id `deviceId` must be an audio output device. Asynchronously returns whether the operation succeeded. > **Note** > > Some browsers do not support output device selection. You can check by calling [supportsMediaOutput](/docs/browser-sdk/v3/js/reference/webrtc/supports-media-output). #### Parameters **`el`** `HTMLMediaElement | null` — required Target element. --- **`deviceId`** `string` — required Id of the audio output device. --- #### Returns `Promise` #### Example ```javascript const el = document.querySelector("video"); const outDevices = await SignalWire.WebRTC.getSpeakerDevicesWithPermissions(); await SignalWire.WebRTC.setMediaElementSinkId(el, outDevices[0].deviceId); // true ``` > setMediaElementSinkId function in the WebRTC namespace.