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:
Michael Telatynski 2017-06-01 23:25:44 +01:00
parent aa90d6b097
commit dd4480f8c3
3 changed files with 17 additions and 9 deletions

View file

@ -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;
}
});