Browse Source

feat(ProxyConnectionService): use JitsiConnection to fetch TURN credentials

master
paweldomas 6 years ago
parent
commit
74f48e168e

+ 2
- 5
modules/proxyconnection/ProxyConnectionPC.js View File

@@ -180,11 +180,8 @@ export default class ProxyConnectionPC {
180 180
          * @type {Object}
181 181
          */
182 182
         const iceConfigStub = {
183
-            jvb: { iceServers: [] },
184
-            p2p: {
185
-                iceServers: DEFAULT_STUN_SERVERS,
186
-                ...this._options.iceConfig
187
-            }
183
+            iceServers: DEFAULT_STUN_SERVERS,
184
+            ...this._options.iceConfig
188 185
         };
189 186
 
190 187
         /**

+ 13
- 1
modules/proxyconnection/ProxyConnectionService.js View File

@@ -26,6 +26,9 @@ export default class ProxyConnectionService {
26 26
      * video should be returned as a desktop stream. Defaults to false.
27 27
      * @param {Object} [options.iceConfig] - The {@code RTCConfiguration} to use
28 28
      * for the peer connection.
29
+     * @param {JitsiConnection} [options.jitsiConnection] - The
30
+     * {@code JitsiConnection} which will be used to fetch TURN credentials for
31
+     * the P2P connection.
29 32
      * @param {Function} options.onRemoteStream - Callback to invoke when a
30 33
      * remote video stream has been received and converted to a
31 34
      * {@code JitsiLocakTrack}. The {@code JitsiLocakTrack} will be passed in.
@@ -34,12 +37,21 @@ export default class ProxyConnectionService {
34 37
      * jid to send the message to and the message
35 38
      */
36 39
     constructor(options = {}) {
40
+        const {
41
+            jitsiConnection,
42
+            ...otherOptions
43
+        } = options;
44
+
37 45
         /**
38 46
          * Holds a reference to the collection of all callbacks.
39 47
          *
40 48
          * @type {Object}
41 49
          */
42
-        this._options = options;
50
+        this._options = {
51
+            iceConfig: jitsiConnection
52
+                && jitsiConnection.xmpp.connection.jingle.p2pIceConfig,
53
+            ...otherOptions
54
+        };
43 55
 
44 56
         /**
45 57
          * The active instance of {@code ProxyConnectionService}.

Loading…
Cancel
Save