audioOutputDevice([name])

Class: MediaPlayer.

Description:

Sets or gets a current audio output device. To obtain a list of devices you can use "audioOutputDevices" getter property (e.g. player.audioOutputDevices), which returns a list of devices with their ID and formats.
Device name or ID may be passed, but name is preferred, because when devices are added or removed, their ID may change, because it's just an index of the list of devices (enumerator), but names are unique.

Parameters:

Name Type Description

[name]

string

Audio output device name (or ID) obtained from AudioDevice object using MediaPlayer > audioOutputDevices getter.

Returns:

Returns this component instance when setting, otherwise current audio output device info as an object.

Type: MediaPlayer | string

Examples:

Getting a list of devices and setting first one:

const player = new MediaPlayer();
const _devices = player.audioOutputDevices;

player.audioOutputDevice(_devices[0].name);

Also See: