浏览代码

Merge pull request #13 from isymchych/enumerate-devices-ff

Allow to select devices on Firefox
master
Paweł Domas 9 年前
父节点
当前提交
88d585cd68
共有 2 个文件被更改,包括 14 次插入7 次删除
  1. 13
    6
      modules/RTC/RTCUtils.js
  2. 1
    1
      modules/statistics/statistics.js

+ 13
- 6
modules/RTC/RTCUtils.js 查看文件

67
         constraints.video = { mandatory: {}, optional: [] };
67
         constraints.video = { mandatory: {}, optional: [] };
68
 
68
 
69
         if (options.cameraDeviceId) {
69
         if (options.cameraDeviceId) {
70
+            // new style of settings device id (FF only)
71
+            constraints.video.deviceId = options.cameraDeviceId;
72
+            // old style
70
             constraints.video.optional.push({
73
             constraints.video.optional.push({
71
                 sourceId: options.cameraDeviceId
74
                 sourceId: options.cameraDeviceId
72
             });
75
             });
81
             // same behaviour as true
84
             // same behaviour as true
82
             constraints.audio = { mandatory: {}, optional: []};
85
             constraints.audio = { mandatory: {}, optional: []};
83
             if (options.micDeviceId) {
86
             if (options.micDeviceId) {
87
+                // new style of settings device id (FF only)
88
+                constraints.audio.deviceId = options.micDeviceId;
89
+                // old style
84
                 constraints.audio.optional.push({
90
                 constraints.audio.optional.push({
85
                     sourceId: options.micDeviceId
91
                     sourceId: options.micDeviceId
86
                 });
92
                 });
99
             if (options.micDeviceId) {
105
             if (options.micDeviceId) {
100
                 constraints.audio = {
106
                 constraints.audio = {
101
                     mandatory: {},
107
                     mandatory: {},
108
+                    deviceId: options.micDeviceId, // new style
102
                     optional: [{
109
                     optional: [{
103
-                        sourceId: options.micDeviceId
110
+                        sourceId: options.micDeviceId // old style
104
                     }]};
111
                     }]};
105
             } else {
112
             } else {
106
                 constraints.audio = true;
113
                 constraints.audio = true;
255
         label: 'Auto',
262
         label: 'Auto',
256
         kind: kind,
263
         kind: kind,
257
         deviceId: '',
264
         deviceId: '',
258
-        groupId: null
265
+        groupId: ''
259
     };
266
     };
260
 }
267
 }
261
 
268
 
790
      * false if not.
797
      * false if not.
791
      */
798
      */
792
     isDeviceChangeAvailable: function () {
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
      * A method to handle stopping of the stream.
806
      * A method to handle stopping of the stream.

+ 1
- 1
modules/statistics/statistics.js 查看文件

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

正在加载...
取消
保存