Input/Output Device Selection
Getting Available Devices
Before connecting to an audio channel you have the option of selecting which audio input (microphone) and output (speaker) device to use. If you do not specify an input device the operating system's default device will be used.
In order to get the current list of available audio devices you can use the getMediaList()
method.
Example Device List Retrieval
let devices = await aloAudio.getMediaList();
const listElement = document.querySelector('select#availableMicrophones');
listElement.innerText = null;
Object.values(devices[AloAudio.MEDIA_DEVICE_LIST_AUDIO_INPUT]).forEach(device => {
const inputOption = document.createElement('option');
inputOption.value = device.id;
inputOption.label = device.label;
inputOption.innerText = device.label;
listElement.add(inputOption);
});
Input Device Related Events
Event
Description
onDeviceListUpdate
This event will let you know the list of available input devices has changed.
Example onDeviceListUpdate
event payload:
{
detail : {
type: "audioinput",
devices : {
80c24043a7acb547b1eda7f0de20ea9917e6dea90091dab7a5a5258f74e91714: {
id: "80c24043a7acb547b1eda7f0de20ea9917e6dea90091dab7a5a5258f74e91714",
label: ""Microphone (HD Webcam C615) (046d:082c)"",
type: "audioinput"
},
752999ac8b718aa41f3d2a9755dfabf2b8f80d613701a36b487939b38ab6095d: {
id: "752999ac8b718aa41f3d2a9755dfabf2b8f80d613701a36b487939b38ab6095d",
label: "Microphone Array (Realtek(R) Audio)",
type: "audioinput"
}
}
}
}
Last updated