Przeglądaj źródła

allow to select devices on Firefox

master
isymchych 9 lat temu
rodzic
commit
cdf871dc2f
2 zmienionych plików z 14 dodań i 7 usunięć
  1. 13
    6
      modules/RTC/RTCUtils.js
  2. 1
    1
      modules/statistics/statistics.js

+ 13
- 6
modules/RTC/RTCUtils.js Wyświetl plik

@@ -67,6 +67,9 @@ function getConstraints(um, options) {
67 67
         constraints.video = { mandatory: {}, optional: [] };
68 68
 
69 69
         if (options.cameraDeviceId) {
70
+            // new style of settings device id (FF only)
71
+            constraints.video.deviceId = options.cameraDeviceId;
72
+            // old style
70 73
             constraints.video.optional.push({
71 74
                 sourceId: options.cameraDeviceId
72 75
             });
@@ -81,6 +84,9 @@ function getConstraints(um, options) {
81 84
             // same behaviour as true
82 85
             constraints.audio = { mandatory: {}, optional: []};
83 86
             if (options.micDeviceId) {
87
+                // new style of settings device id (FF only)
88
+                constraints.audio.deviceId = options.micDeviceId;
89
+                // old style
84 90
                 constraints.audio.optional.push({
85 91
                     sourceId: options.micDeviceId
86 92
                 });
@@ -99,8 +105,9 @@ function getConstraints(um, options) {
99 105
             if (options.micDeviceId) {
100 106
                 constraints.audio = {
101 107
                     mandatory: {},
108
+                    deviceId: options.micDeviceId, // new style
102 109
                     optional: [{
103
-                        sourceId: options.micDeviceId
110
+                        sourceId: options.micDeviceId // old style
104 111
                     }]};
105 112
             } else {
106 113
                 constraints.audio = true;
@@ -255,7 +262,7 @@ function createAutoDeviceInfo(kind) {
255 262
         label: 'Auto',
256 263
         kind: kind,
257 264
         deviceId: '',
258
-        groupId: null
265
+        groupId: ''
259 266
     };
260 267
 }
261 268
 
@@ -790,10 +797,10 @@ var RTCUtils = {
790 797
      * false if not.
791 798
      */
792 799
     isDeviceChangeAvailable: function () {
793
-        if(RTCBrowserType.isChrome() || RTCBrowserType.isOpera() ||
794
-            RTCBrowserType.isTemasysPluginUsed())
795
-            return true;
796
-        return false;
800
+        return RTCBrowserType.isChrome() ||
801
+            RTCBrowserType.isFirefox() ||
802
+            RTCBrowserType.isOpera() ||
803
+            RTCBrowserType.isTemasysPluginUsed();
797 804
     },
798 805
     /**
799 806
      * A method to handle stopping of the stream.

+ 1
- 1
modules/statistics/statistics.js Wyświetl plik

@@ -137,7 +137,7 @@ Statistics.stopLocalStats = function (stream) {
137 137
     for(var i = 0; i < Statistics.localStats.length; i++)
138 138
         if(Statistics.localStats[i].stream === stream){
139 139
             var localStats = Statistics.localStats.splice(i, 1);
140
-            localStats.stop();
140
+            localStats[0].stop();
141 141
             break;
142 142
         }
143 143
 };

Ładowanie…
Anuluj
Zapisz