*** id: 545f7c65-abb3-4d69-98c2-b1235ee22171 title: setMediaElementSinkId slug: /js/reference/webrtc/set-media-element-sink-id description: setMediaElementSinkId function in the WebRTC namespace. max-toc-depth: 3 ---------------- ### 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. 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 Target element. 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 ```