Search code examples
javascriptaudiohtml5-audiogetusermediamediadevices

Request full MediaDeviceInfo without audio/video capture


I'm using the MediaDevices API to get a list of audio output devices:

const outputDevices = (
  await navigator.mediaDevices.enumerateDevices()
).filter(device => device.kind === 'audiooutput');

This works, but label is blank.

I know that if I use getUserMedia() to request an audio or video stream, that I can then re-enumerate devices and get their labels. Is there any way to get permission to view the devices without getUserMedia()? I want to set the sink ID of audio output and have no reason to use capture devices.


Solution

  • This is a known limitation of the Audio Output Devices API unfortunately - the discussion on the github issue point towards possible solutions, but no clear decision has been made yet.