FS-8003 #resolve Use audioInDevices instead of audioDevices to match verto plugin.

FS-8003 Also make modifications so that refreshing device actually calls APIs on the verto library instead of just reparsing it's output.
This commit is contained in:
Joao Mesquita 2015-08-20 18:33:39 -03:00
parent aa0bbe84af
commit c0a5c54bc1

View File

@ -234,85 +234,78 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location',
refreshDevices: function(callback) { refreshDevices: function(callback) {
console.debug('Attempting to refresh the devices.'); console.debug('Attempting to refresh the devices.');
function refreshDevicesCallback() {
data.videoDevices = [{
id: 'none',
label: 'No camera'
}];
data.shareDevices = [{
id: 'screen',
label: 'Screen'
}];
data.audioDevices = [];
data.selectedVideo = 'none';
data.selectedShare = 'screen';
data.selectedAudio = null;
data.videoDevices = [{ for (var i in jQuery.verto.videoDevices) {
id: 'none', var device = jQuery.verto.videoDevices[i];
label: 'No camera' if (!device.label) {
}]; data.videoDevices.push({
data.shareDevices = [{ id: 'Camera ' + i,
id: 'screen', label: 'Camera ' + i
label: 'Screen' });
}]; } else {
data.audioDevices = []; data.videoDevices.push({
id: device.id,
label: device.label || device.id
});
}
data.selectedVideo = 'none'; // Selecting the first source.
data.selectedShare = 'screen'; if (i == 0) {
data.selectedAudio = null; data.selectedVideo = device.id;
}
for (var i in jQuery.verto.videoDevices) { if (!device.label) {
var device = jQuery.verto.videoDevices[i]; data.shareDevices.push({
if (!device.label) { id: 'Share Device ' + i,
data.videoDevices.push({ label: 'Share Device ' + i
id: 'Camera ' + i, });
label: 'Camera ' + i continue;
}); }
} else {
data.videoDevices.push({ data.shareDevices.push({
id: device.id, id: device.id,
label: device.label || device.id label: device.label || device.id
}); });
} }
// Selecting the first source. for (var i in jQuery.verto.audioInDevices) {
if (i == 0) { var device = jQuery.verto.audioInDevices[i];
data.selectedVideo = device.id; // Selecting the first source.
} if (i == 0) {
data.selectedAudio = device.id;
}
if (!device.label) { if (!device.label) {
data.shareDevices.push({ data.audioDevices.push({
id: 'Share Device ' + i, id: 'Microphone ' + i,
label: 'Share Device ' + i label: 'Microphone ' + i
}); });
continue; continue;
} }
data.shareDevices.push({
id: device.id,
label: device.label || device.id
});
}
for (var i in jQuery.verto.audioDevices) {
var device = jQuery.verto.audioDevices[i];
// Selecting the first source.
if (i == 0) {
data.selectedAudio = device.id;
}
if (!device.label) {
data.audioDevices.push({ data.audioDevices.push({
id: 'Microphone ' + i, id: device.id,
label: 'Microphone ' + i label: device.label || device.id
}); });
continue;
} }
data.audioDevices.push({ console.debug('Devices were refreshed.');
id: device.id, };
label: device.label || device.id
});
}
console.debug('Devices were refreshed.'); jQuery.verto.refreshDevices(refreshDevicesCallback);
if (angular.isFunction(callback)) {
var devices = {
audio: data.audioDevices,
video: data.videoDevices,
share: data.shareDevices
};
callback(data.instance, devices);
}
}, },
/** /**