瀏覽代碼

Enables adapter and desktop sharing for Edge.

* Enables adapter for edge.

We were not filtering correctly all unsupported iceServers and an error is thrown and no connection is established.

* Enable desktop sharing for Edge.

Currently when replacing video track with desktop sharing one, doesn't work because of: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/17528460/
If Edge user joins first and enables desktop sharing it will work when others join. Tried also to use replaceTrack/setTrack as a workaround, but again we hit an error, this time InvalidAccessError.

* Adds the helper function usesAdapter in BrowserCaps.
dev1
Дамян Минков 7 年之前
父節點
當前提交
43ab27193e
No account linked to committer's email address

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

31
 // Require adapter only for certain browsers. This is being done for
31
 // Require adapter only for certain browsers. This is being done for
32
 // react-native, which has its own shims, and while browsers are being migrated
32
 // react-native, which has its own shims, and while browsers are being migrated
33
 // over to use adapter's shims.
33
 // over to use adapter's shims.
34
-if (browser.usesNewGumFlow()) {
34
+if (browser.usesAdapter()) {
35
     require('webrtc-adapter');
35
     require('webrtc-adapter');
36
 }
36
 }
37
 
37
 

+ 9
- 0
modules/RTC/ScreenObtainer.js 查看文件

193
             }
193
             }
194
 
194
 
195
             return this.obtainScreenOnFirefox;
195
             return this.obtainScreenOnFirefox;
196
+        } else if (browser.isEdge() && navigator.getDisplayMedia) {
197
+            return (_, onSuccess, onFailure) => {
198
+                navigator.getDisplayMedia({ video: true })
199
+                    .then(stream => onSuccess({
200
+                        stream,
201
+                        sourceId: stream.id
202
+                    }))
203
+                    .catch(onFailure);
204
+            };
196
         }
205
         }
197
 
206
 
198
         logger.log(
207
         logger.log(

+ 1
- 29
modules/RTC/ortc/RTCPeerConnection.js 查看文件

1970
         this._dtlsTransport = dtlsTransport;
1970
         this._dtlsTransport = dtlsTransport;
1971
     }
1971
     }
1972
 
1972
 
1973
-    /**
1974
-     * Pares STUN and TURN servers to only one. This works around an issue on
1975
-     * edge where an error occurs if multiple are declared.
1976
-     * See https://developer.microsoft.com/en-us/microsoft-edge/platform
1977
-     * /issues/10163458
1978
-     *
1979
-     * @param {array} servers - All STUN AND TURN servers to connect to.
1980
-     * @private
1981
-     * @returns {array} An array with only one STUN server and one TURN server
1982
-     * at the most.
1983
-     */
1984
-    _filterServers(servers = []) {
1985
-        const filteredServers = [];
1986
-        const firstStun = servers.find(server => server.url.startsWith('stun'));
1987
-
1988
-        if (firstStun) {
1989
-            filteredServers.push(firstStun);
1990
-        }
1991
-
1992
-        const firstTurn = servers.find(server => server.url.startsWith('turn'));
1993
-
1994
-        if (firstTurn) {
1995
-            filteredServers.push(firstTurn);
1996
-        }
1997
-
1998
-        return filteredServers;
1999
-    }
2000
-
2001
     /**
1973
     /**
2002
      * Creates the RTCIceGatherer.
1974
      * Creates the RTCIceGatherer.
2003
      * @private
1975
      * @private
2005
     _setIceGatherer(pcConfig) {
1977
     _setIceGatherer(pcConfig) {
2006
         const iceGatherOptions = {
1978
         const iceGatherOptions = {
2007
             gatherPolicy: pcConfig.iceTransportPolicy || 'all',
1979
             gatherPolicy: pcConfig.iceTransportPolicy || 'all',
2008
-            iceServers: this._filterServers(pcConfig.iceServers)
1980
+            iceServers: pcConfig.iceServers
2009
         };
1981
         };
2010
         const iceGatherer = new RTCIceGatherer(iceGatherOptions);
1982
         const iceGatherer = new RTCIceGatherer(iceGatherOptions);
2011
 
1983
 

+ 10
- 0
modules/browser/BrowserCapabilities.js 查看文件

229
             || this.isSafariWithWebrtc();
229
             || this.isSafariWithWebrtc();
230
 
230
 
231
     }
231
     }
232
+
233
+    /**
234
+     * Checks if the browser uses webrtc-adapter. All browsers using the new
235
+     * getUserMedia flow and Edge.
236
+     *
237
+     * @returns {boolean}
238
+     */
239
+    usesAdapter() {
240
+        return this.usesNewGumFlow() || this.isEdge();
241
+    }
232
 }
242
 }

Loading…
取消
儲存