setPreferredSinkId() enables a top-level frame to override the default audio output device for all audio renderers in the top-level frame and its child frames, including cross-origin child frames. To enable in Edge/Chrome, use the following flag or command line argument:

Flag: about://flags/#enable-experimental-web-platform-features
Command Line: --enable-features=PreferredAudioOutputDevices

Learn more

  • Explainer
  • Chrome Status
  • Chromium Bug

  • This demo requires microphone access to enumerate audio output devices.

    Top-Level Frame:

    navigator.mediaDevices.setPreferredSinkId()



    sinkId: ""

    HTMLAudioElement.setSinkId()





    sinkId: ""

    AudioContext.setSinkId()



      

    sinkId: ""



    Same Origin Iframe:

    Cross-Origin Iframe: