Procházet zdrojové kódy

Move disco-info initialization to the XMPP module

dev1
paweldomas před 9 roky
rodič
revize
97e2e845f4
2 změnil soubory, kde provedl 42 přidání a 33 odebrání
  1. 0
    33
      modules/xmpp/strophe.jingle.js
  2. 42
    0
      modules/xmpp/xmpp.js

+ 0
- 33
modules/xmpp/strophe.jingle.js Zobrazit soubor

@@ -21,39 +21,6 @@ module.exports = function(XMPP, eventEmitter) {
21 21
         },
22 22
         init: function (conn) {
23 23
             this.connection = conn;
24
-            var disco = conn.disco;
25
-            if (disco) {
26
-                // http://xmpp.org/extensions/xep-0167.html#support
27
-                // http://xmpp.org/extensions/xep-0176.html#support
28
-                disco.addFeature('urn:xmpp:jingle:1');
29
-                disco.addFeature('urn:xmpp:jingle:apps:rtp:1');
30
-                disco.addFeature('urn:xmpp:jingle:transports:ice-udp:1');
31
-                disco.addFeature('urn:xmpp:jingle:apps:dtls:0');
32
-                disco.addFeature('urn:xmpp:jingle:transports:dtls-sctp:1');
33
-                disco.addFeature('urn:xmpp:jingle:apps:rtp:audio');
34
-                disco.addFeature('urn:xmpp:jingle:apps:rtp:video');
35
-
36
-                // Lipsync
37
-                if (this.options.enableLipSync && RTCBrowserType.isChrome()) {
38
-                    logger.info("Lip-sync enabled !");
39
-                    this.connection.disco.addFeature(
40
-                        'http://jitsi.org/meet/lipsync');
41
-                }
42
-
43
-                if (RTCBrowserType.isChrome() || RTCBrowserType.isOpera()
44
-                    || RTCBrowserType.isTemasysPluginUsed()) {
45
-                    disco.addFeature('urn:ietf:rfc:4588');
46
-                }
47
-
48
-                // this is dealt with by SDP O/A so we don't need to announce this
49
-                //disco.addFeature('urn:xmpp:jingle:apps:rtp:rtcp-fb:0'); // XEP-0293
50
-                //disco.addFeature('urn:xmpp:jingle:apps:rtp:rtp-hdrext:0'); // XEP-0294
51
-
52
-                disco.addFeature('urn:ietf:rfc:5761'); // rtcp-mux
53
-                disco.addFeature('urn:ietf:rfc:5888'); // a=group, e.g. bundle
54
-
55
-                //disco.addFeature('urn:ietf:rfc:5576'); // a=ssrc
56
-            }
57 24
             this.connection.addHandler(this.onJingle.bind(this), 'urn:xmpp:jingle:1', 'iq', 'set', null, null);
58 25
         },
59 26
         onJingle: function (iq) {

+ 42
- 0
modules/xmpp/xmpp.js Zobrazit soubor

@@ -8,6 +8,7 @@ var XMPPEvents = require("../../service/xmpp/XMPPEvents");
8 8
 var JitsiConnectionErrors = require("../../JitsiConnectionErrors");
9 9
 var JitsiConnectionEvents = require("../../JitsiConnectionEvents");
10 10
 var RTC = require("../RTC/RTC");
11
+var RTCBrowserType = require("../RTC/RTCBrowserType");
11 12
 
12 13
 var authenticatedUser = false;
13 14
 
@@ -44,6 +45,9 @@ function XMPP(options, token) {
44 45
 
45 46
     this.connection = createConnection(options.bosh, token);
46 47
 
48
+    // Initialize features advertised in disco-info
49
+    this.initFeaturesList();
50
+
47 51
     // Setup a disconnect on unload as a way to facilitate API consumers. It
48 52
     // sounds like they would want that. A problem for them though may be if
49 53
     // they wanted to utilize the connected connection in an unload handler of
@@ -52,6 +56,44 @@ function XMPP(options, token) {
52 56
     $(window).on('beforeunload unload', this.disconnect.bind(this));
53 57
 }
54 58
 
59
+/**
60
+ * Initializes the list of feature advertised through the disco-info mechanism
61
+ */
62
+XMPP.prototype.initFeaturesList = function () {
63
+    var disco = this.connection.disco;
64
+    if (disco) {
65
+        // http://xmpp.org/extensions/xep-0167.html#support
66
+        // http://xmpp.org/extensions/xep-0176.html#support
67
+        disco.addFeature('urn:xmpp:jingle:1');
68
+        disco.addFeature('urn:xmpp:jingle:apps:rtp:1');
69
+        disco.addFeature('urn:xmpp:jingle:transports:ice-udp:1');
70
+        disco.addFeature('urn:xmpp:jingle:apps:dtls:0');
71
+        disco.addFeature('urn:xmpp:jingle:transports:dtls-sctp:1');
72
+        disco.addFeature('urn:xmpp:jingle:apps:rtp:audio');
73
+        disco.addFeature('urn:xmpp:jingle:apps:rtp:video');
74
+
75
+        if (RTCBrowserType.isChrome() || RTCBrowserType.isOpera()
76
+            || RTCBrowserType.isTemasysPluginUsed()) {
77
+            disco.addFeature('urn:ietf:rfc:4588');
78
+        }
79
+
80
+        // this is dealt with by SDP O/A so we don't need to announce this
81
+        //disco.addFeature('urn:xmpp:jingle:apps:rtp:rtcp-fb:0'); // XEP-0293
82
+        //disco.addFeature('urn:xmpp:jingle:apps:rtp:rtp-hdrext:0'); // XEP-0294
83
+
84
+        disco.addFeature('urn:ietf:rfc:5761'); // rtcp-mux
85
+        disco.addFeature('urn:ietf:rfc:5888'); // a=group, e.g. bundle
86
+
87
+        //disco.addFeature('urn:ietf:rfc:5576'); // a=ssrc
88
+
89
+        // Enable Lipsync ?
90
+        if (this.options.enableLipSync && RTCBrowserType.isChrome()) {
91
+            logger.info("Lip-sync enabled !");
92
+            this.connection.disco.addFeature('http://jitsi.org/meet/lipsync');
93
+        }
94
+    }
95
+};
96
+
55 97
 XMPP.prototype.getConnection = function () { return this.connection; };
56 98
 
57 99
 /**

Načítá se…
Zrušit
Uložit