]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-8003 #resolve Use audioInDevices instead of audioDevices to match verto plugin.
authorJoao Mesquita <jmesquita@indicium.com.ar>
Thu, 20 Aug 2015 21:33:39 +0000 (18:33 -0300)
committerJoao Mesquita <jmesquita@indicium.com.ar>
Thu, 20 Aug 2015 23:36:00 +0000 (20:36 -0300)
FS-8003 Also make modifications so that refreshing device actually calls APIs on the verto library instead of just reparsing it's output.

html5/verto/verto_communicator/js/verto-service.js

index c126b4e51775bb18715a97ac3d5e133766c0180b..04a43d2e06c2969e87066da9e852965bdaf8de36 100644 (file)
@@ -234,85 +234,78 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location',
 
       refreshDevices: function(callback) {
         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;
+
+          for (var i in jQuery.verto.videoDevices) {
+            var device = jQuery.verto.videoDevices[i];
+            if (!device.label) {
+              data.videoDevices.push({
+                id: 'Camera ' + i,
+                label: 'Camera ' + i
+              });
+            } else {
+              data.videoDevices.push({
+                id: device.id,
+                label: device.label || device.id
+              });
+            }
 
+            // Selecting the first source.
+            if (i == 0) {
+              data.selectedVideo = device.id;
+            }
 
-        data.videoDevices = [{
-          id: 'none',
-          label: 'No camera'
-        }];
-        data.shareDevices = [{
-          id: 'screen',
-          label: 'Screen'
-        }];
-        data.audioDevices = [];
-
-        data.selectedVideo = 'none';
-        data.selectedShare = 'screen';
-        data.selectedAudio = null;
-
-        for (var i in jQuery.verto.videoDevices) {
-          var device = jQuery.verto.videoDevices[i];
-          if (!device.label) {
-            data.videoDevices.push({
-              id: 'Camera ' + i,
-              label: 'Camera ' + i
-            });
-          } else {
-            data.videoDevices.push({
-              id: device.id,
-              label: device.label || device.id
-            });
-          }
-
-          // Selecting the first source.
-          if (i == 0) {
-            data.selectedVideo = device.id;
-          }
+            if (!device.label) {
+              data.shareDevices.push({
+                id: 'Share Device ' + i,
+                label: 'Share Device ' + i
+              });
+              continue;
+            }
 
-          if (!device.label) {
             data.shareDevices.push({
-              id: 'Share Device ' + i,
-              label: 'Share Device ' + i
+              id: device.id,
+              label: device.label || device.id
             });
-            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;
-          }
+          for (var i in jQuery.verto.audioInDevices) {
+            var device = jQuery.verto.audioInDevices[i];
+            // Selecting the first source.
+            if (i == 0) {
+              data.selectedAudio = device.id;
+            }
 
-          if (!device.label) {
+            if (!device.label) {
+              data.audioDevices.push({
+                id: 'Microphone ' + i,
+                label: 'Microphone ' + i
+              });
+              continue;
+            }
             data.audioDevices.push({
-              id: 'Microphone ' + i,
-              label: 'Microphone ' + i
+              id: device.id,
+              label: device.label || device.id
             });
-            continue;
           }
-          data.audioDevices.push({
-            id: device.id,
-            label: device.label || device.id
-          });
-        }
+          console.debug('Devices were refreshed.');
+        };
 
-        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);
-        }
       },
 
       /**