This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The HTMLMediaElement.setSinkId() method sets the ID of the audio device to use for output and returns a Promise. This only works when the application is authorized to use the specified device.


HTMLMediaElement.setSinkId(sinkId).then(function() { ... })


A Promise that resolves to undefined.


The MediaDeviceInfo.deviceId of the audio output device.


This function can throw a DOMException (No permission to use requested device).


const devices = await navigator.mediaDevices.enumerateDevices();
const audioDevices = devices.filter(device => device.kind === 'audiooutput');
const audio = document.createElement('audio');
await audio.setSinkId(audioDevices[0].deviceId);
console.log('Audio is being played on ' + audio.sinkId);


Specification Status Comment
Audio Output Devices API
The definition of 'sinkId' in that specification.
Candidate Recommendation Initial definition. Older versions of this spec were called "Media Capture Output".

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 49 ? ? 36 ?
Feature Android Webview Chrome for Android Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile
Basic support 49 49 ? ? ? 36 ?

Document Tags and Contributors

 Contributors to this page: jpmedley, Jedipedia, rolfedh
 Last updated by: jpmedley,