It will be better if there is category like as “Proposal for Improvement”, so we can propose our thoughts(not bug) to improve openVidu.
Ex: In OpenVidu Browser getDevices
function returns the information about connected audio and video devices as an object. Here is the respective code:
deviceInfos.forEach(function (deviceInfo) {
if (deviceInfo.kind === 'audioinput' || deviceInfo.kind === 'videoinput') {
devices.push({
kind: deviceInfo.kind,
deviceId: deviceInfo.deviceId,
label: deviceInfo.label
});
}
});
Above deviceInfo
is an object which has 4 properties - kind, deviceId, label & groupId. You are not pushing that deviceInfo object to devices
, instead you push only kind, deviceId & label. Why do you not push groupId
? As far i know, with the same groupId
, input devices are the same but with different label & deviceId. So, if we get the devices info with groupId - we can filter the devices with groupId and show the user to choose their audio/video input device. Respective code can be like this:
// For audio input devices
OV.getDevices().then(devices => {
const audioInputDevices = devices.filter(device => device.kind === 'audioinput' && !isOnlyWhitespace(device.label));
if(audioInputDevices.length <= 0) {
// Assume audio source dropdown
$('#audioSource').append(`
<option disabled selected>No audio input device found</option>
`);
}else {
const audioInputDevices_ = [];
const audioInputDevicesFinal = [];
audioInputDevices.map(device => {
if(!audioInputDevices_.includes(device.groupId)) {
audioInputDevices_.push(device.groupId);
audioInputDevicesFinal.push(device);
}
});
audioInputDevicesFinal.map(device => {
$('#audioSource').append(`
<option value="${device.deviceId}">${device.label}</option>
`);
});
}
});
Its definitely not a bug, so i shouldn’t report an issue on github. But there should be a chance to propose my thoughts.