Project: list all media devices, then select 1 specific audio output device which is different from the default of Windows
I used enumerateDevices(), following many code examples, example here, and:
- on Firefox: list of audioinput, videoinput, no audiooutput showed, but only 1 for each (I have 2 inputs, 3 outputs)
- on Chrome, Brave: same list showed, also only 1 for each, and empty kind/label/id (groupId is none-empty though)
code:
function checkDevices(devices){
(async () => {
await navigator.mediaDevices.getUserMedia({audio: true, video: true});
let devices = await navigator.mediaDevices.enumerateDevices();
devices.forEach(function (device) {
console.log(device.kind + ": " + device.label + " id: " + device.groupId);//Other parameters device.kind/device.deviceId
});
})();
}
function checkError(err){
console.log(err.name + ": " + err.message);
}
navigator.mediaDevices.enumerateDevices().then(checkDevices).catch(checkError);
Can someone help?
output Firefox enter image description here
output Chrome (same on Brave) enter image description here