Bläddra i källkod

feat(ProxyConnectionService): use JitsiConnection to fetch TURN credentials

master
paweldomas 6 år sedan
förälder
incheckning
74f48e168e

+ 2
- 5
modules/proxyconnection/ProxyConnectionPC.js Visa fil

180
          * @type {Object}
180
          * @type {Object}
181
          */
181
          */
182
         const iceConfigStub = {
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 Visa fil

26
      * video should be returned as a desktop stream. Defaults to false.
26
      * video should be returned as a desktop stream. Defaults to false.
27
      * @param {Object} [options.iceConfig] - The {@code RTCConfiguration} to use
27
      * @param {Object} [options.iceConfig] - The {@code RTCConfiguration} to use
28
      * for the peer connection.
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
      * @param {Function} options.onRemoteStream - Callback to invoke when a
32
      * @param {Function} options.onRemoteStream - Callback to invoke when a
30
      * remote video stream has been received and converted to a
33
      * remote video stream has been received and converted to a
31
      * {@code JitsiLocakTrack}. The {@code JitsiLocakTrack} will be passed in.
34
      * {@code JitsiLocakTrack}. The {@code JitsiLocakTrack} will be passed in.
34
      * jid to send the message to and the message
37
      * jid to send the message to and the message
35
      */
38
      */
36
     constructor(options = {}) {
39
     constructor(options = {}) {
40
+        const {
41
+            jitsiConnection,
42
+            ...otherOptions
43
+        } = options;
44
+
37
         /**
45
         /**
38
          * Holds a reference to the collection of all callbacks.
46
          * Holds a reference to the collection of all callbacks.
39
          *
47
          *
40
          * @type {Object}
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
          * The active instance of {@code ProxyConnectionService}.
57
          * The active instance of {@code ProxyConnectionService}.

Laddar…
Avbryt
Spara