change device data structure to array of objects
so that we can set falsey values, for unsetting device most dolphinately needs testing Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
aa90d6b097
commit
dd4480f8c3
3 changed files with 17 additions and 9 deletions
|
@ -23,15 +23,15 @@ export default {
|
|||
// Only needed for Electron atm, though should work in modern browsers
|
||||
// once permission has been granted to the webapp
|
||||
return navigator.mediaDevices.enumerateDevices().then(function(devices) {
|
||||
const audioIn = {};
|
||||
const videoIn = {};
|
||||
const audioIn = [];
|
||||
const videoIn = [];
|
||||
|
||||
if (devices.some((device) => !device.label)) return false;
|
||||
|
||||
devices.forEach((device) => {
|
||||
switch (device.kind) {
|
||||
case 'audioinput': audioIn[device.deviceId] = device.label; break;
|
||||
case 'videoinput': videoIn[device.deviceId] = device.label; break;
|
||||
case 'audioinput': audioIn.push(device); break;
|
||||
case 'videoinput': videoIn.push(device); break;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue