Преглед изворни кода

get stun and turn credentials from server

j8
Philipp Hancke пре 12 година
родитељ
комит
edf3fc64b0
2 измењених фајлова са 3 додато и 1 уклоњено
  1. 1
    0
      app.js
  2. 2
    1
      libs/strophejingle.bundle.js

+ 1
- 0
app.js Прегледај датотеку

34
     connection.connect(jid, document.getElementById('password').value, function (status) {
34
     connection.connect(jid, document.getElementById('password').value, function (status) {
35
         if (status == Strophe.Status.CONNECTED) {
35
         if (status == Strophe.Status.CONNECTED) {
36
             console.log('connected');
36
             console.log('connected');
37
+            connection.jingle.getStunAndTurnCredentials();
37
             if (RTC.browser == 'firefox') {
38
             if (RTC.browser == 'firefox') {
38
                 getUserMediaWithConstraints(['audio']);
39
                 getUserMediaWithConstraints(['audio']);
39
             } else {
40
             } else {

+ 2
- 1
libs/strophejingle.bundle.js Прегледај датотеку

571
         // validity have to be fetched before creating the peerconnection
571
         // validity have to be fetched before creating the peerconnection
572
         // TODO: implement refresh via updateIce as described in
572
         // TODO: implement refresh via updateIce as described in
573
         //      https://code.google.com/p/webrtc/issues/detail?id=1650
573
         //      https://code.google.com/p/webrtc/issues/detail?id=1650
574
+        var self = this;
574
         this.connection.sendIQ(
575
         this.connection.sendIQ(
575
             $iq({type: 'get', to: this.connection.domain})
576
             $iq({type: 'get', to: this.connection.domain})
576
                 .c('services', {xmlns: 'urn:xmpp:extdisco:1'}).c('service', {host: 'turn.' + this.connection.domain}),
577
                 .c('services', {xmlns: 'urn:xmpp:extdisco:1'}).c('service', {host: 'turn.' + this.connection.domain}),
610
                         break;
611
                         break;
611
                     }
612
                     }
612
                 });
613
                 });
613
-                this.ice_config.iceServers = iceservers;
614
+                self.ice_config.iceServers = iceservers;
614
             },
615
             },
615
             function (err) {
616
             function (err) {
616
                 console.warn('getting turn credentials failed', err);
617
                 console.warn('getting turn credentials failed', err);

Loading…
Откажи
Сачувај