Answers for "how to implement loudspeaker in web development"

0

how to implement loudspeaker in web development

navigator.mediaDevices.enumerateDevices()  .then(gotDevices)  .catch(errorCallback);...function gotDevices(deviceInfos) {  ...  for (var i = 0; i !== deviceInfos.length; ++i) {    var deviceInfo = deviceInfos[i];    var option = document.createElement('option');    option.value = deviceInfo.deviceId;    if (deviceInfo.kind === 'audioinput') {      option.text = deviceInfo.label ||        'Microphone ' + (audioInputSelect.length + 1);      audioInputSelect.appendChild(option);    } else if (deviceInfo.kind === 'audiooutput') {      option.text = deviceInfo.label || 'Speaker ' +        (audioOutputSelect.length + 1);      audioOutputSelect.appendChild(option);    } else if (deviceInfo.kind === 'videoinput') {      option.text = deviceInfo.label || 'Camera ' +        (videoSelect.length + 1);      videoSelect.appendChild(option);    }  ...}
Posted by: Guest on June-29-2021

Code answers related to "how to implement loudspeaker in web development"

Browse Popular Code Answers by Language