Преглед на файлове

Focus and debug changes

j8
paweldomas преди 11 години
родител
ревизия
f629ec17fa
променени са 5 файла, в които са добавени 57 реда и са изтрити 47 реда
  1. 43
    45
      app.js
  2. 2
    1
      config.js
  3. 9
    0
      libs/strophe/strophe.jingle.adapter.js
  4. 2
    0
      libs/strophe/strophe.jingle.session.js
  5. 1
    1
      muc.js

+ 43
- 45
app.js Целия файл

@@ -2,7 +2,6 @@
2 2
 /* application specific logic */
3 3
 var connection = null;
4 4
 var authenticatedUser = false;
5
-var focus = null;
6 5
 var activecall = null;
7 6
 var RTC = null;
8 7
 var nickname = null;
@@ -595,7 +594,7 @@ $(document).bind('conferenceCreated.jingle', function (event, focus)
595 594
 
596 595
 $(document).bind('callterminated.jingle', function (event, sid, jid, reason) {
597 596
     // Leave the room if my call has been remotely terminated.
598
-    if (connection.emuc.joined && focus == null && reason === 'kick') {
597
+    if (connection.emuc.joined && reason === 'kick') {
599 598
         sessionTerminated = true;
600 599
         connection.emuc.doLeave();
601 600
         messageHandler.openMessageDialog("Session Terminated",
@@ -677,7 +676,7 @@ $(document).bind('joined.muc', function (event, jid, info) {
677 676
         document.createTextNode(Strophe.getResourceFromJid(jid) + ' (me)')
678 677
     );
679 678
 
680
-    if (Object.keys(connection.emuc.members).length < 1) {
679
+/*    if (Object.keys(connection.emuc.members).length < 1) {
681 680
         focus = new ColibriFocus(connection, config.hosts.bridge);
682 681
         if (nickname !== null) {
683 682
             focus.setEndpointDisplayName(connection.emuc.myroomjid,
@@ -694,7 +693,23 @@ $(document).bind('joined.muc', function (event, jid, info) {
694 693
 
695 694
     if (focus && config.etherpad_base) {
696 695
         Etherpad.init();
697
-    }
696
+    }*/
697
+
698
+    var elem = $iq({to: config.hosts.focus, type: 'set'});
699
+    elem.c('conference', {
700
+        xmlns: 'http://jitsi.org/protocol/focus',
701
+        room: roomUrl.substr(roomUrl.lastIndexOf("/") + 1)
702
+    });
703
+    elem.up();
704
+
705
+    connection.sendIQ(elem,
706
+        function (result) {
707
+            console.info("Focus replied ", result);
708
+        },
709
+        function (error) {
710
+            console.warn(error);
711
+        }
712
+    );
698 713
 
699 714
     VideoLayout.showFocusIndicator();
700 715
 
@@ -720,6 +735,12 @@ $(document).bind('entered.muc', function (event, jid, info, pres) {
720 735
 
721 736
     console.log('is focus? ' + (focus ? 'true' : 'false'));
722 737
 
738
+    if (Strophe.getResourceFromJid(jid).indexOf('focus') != -1)
739
+    {
740
+        console.info("Ignore focus");
741
+        return;
742
+    }
743
+
723 744
     // Add Peer's container
724 745
     VideoLayout.ensurePeerContainerExists(jid);
725 746
 
@@ -728,7 +749,7 @@ $(document).bind('entered.muc', function (event, jid, info, pres) {
728 749
         APIConnector.triggerEvent("participantJoined",{jid: jid});
729 750
     }
730 751
 
731
-    if (focus !== null) {
752
+    /*if (focus !== null) {
732 753
         // FIXME: this should prepare the video
733 754
         if (focus.confid === null) {
734 755
             console.log('make new conference with', jid);
@@ -743,7 +764,7 @@ $(document).bind('entered.muc', function (event, jid, info, pres) {
743 764
             console.log('invite', jid, 'into conference');
744 765
             focus.addNewParticipant(jid);
745 766
         }
746
-    }
767
+    }*/
747 768
 });
748 769
 
749 770
 $(document).bind('left.muc', function (event, jid) {
@@ -784,41 +805,6 @@ $(document).bind('left.muc', function (event, jid) {
784 805
 
785 806
     connection.jingle.terminateByJid(jid);
786 807
 
787
-    if (focus == null
788
-            // I shouldn't be the one that left to enter here.
789
-            && jid !== connection.emuc.myroomjid
790
-            && connection.emuc.myroomjid === connection.emuc.list_members[0]
791
-            // If our session has been terminated for some reason
792
-            // (kicked, hangup), don't try to become the focus
793
-            && !sessionTerminated) {
794
-        console.log('welcome to our new focus... myself');
795
-        focus = new ColibriFocus(connection, config.hosts.bridge);
796
-        if (nickname !== null) {
797
-            focus.setEndpointDisplayName(connection.emuc.myroomjid,
798
-                                         nickname);
799
-        }
800
-
801
-        Toolbar.showSipCallButton(true);
802
-
803
-        if (Object.keys(connection.emuc.members).length > 0) {
804
-            focus.makeConference(Object.keys(connection.emuc.members));
805
-            Toolbar.showRecordingButton(true);
806
-        }
807
-        $(document).trigger('focusechanged.muc', [focus]);
808
-    }
809
-    else if (focus && Object.keys(connection.emuc.members).length === 0) {
810
-        console.log('everyone left');
811
-        // FIXME: closing the connection is a hack to avoid some
812
-        // problems with reinit
813
-        disposeConference();
814
-        focus = new ColibriFocus(connection, config.hosts.bridge);
815
-        if (nickname !== null) {
816
-            focus.setEndpointDisplayName(connection.emuc.myroomjid,
817
-                                         nickname);
818
-        }
819
-        Toolbar.showSipCallButton(true);
820
-        Toolbar.showRecordingButton(false);
821
-    }
822 808
     if (connection.emuc.getPrezi(jid)) {
823 809
         $(document).trigger('presentationremoved.muc',
824 810
                             [jid, connection.emuc.getPrezi(jid)]);
@@ -867,10 +853,16 @@ $(document).bind('presence.muc', function (event, jid, info, pres) {
867 853
     if (displayName && displayName.length > 0)
868 854
         $(document).trigger('displaynamechanged',
869 855
                             [jid, displayName]);
856
+                            [jid, info.displayName]);
857
+    if (Strophe.getResourceFromJid(jid).indexOf('focus') != -1)
858
+    {
859
+        console.info("Ignore focus");
860
+        return;
861
+    }
870 862
 
871
-    if (focus !== null && info.displayName !== null) {
863
+    /*if (focus !== null && info.displayName !== null) {
872 864
         focus.setEndpointDisplayName(jid, info.displayName);
873
-    }
865
+    }*/
874 866
 
875 867
     //check if the video bridge is available
876 868
     if($(pres).find(">bridgeIsDown").length > 0 && !bridgeIsDown) {
@@ -972,7 +964,7 @@ function isVideoSrcDesktop(videoSrc) {
972 964
 }
973 965
 
974 966
 function getConferenceHandler() {
975
-    return focus ? focus : activecall;
967
+    return activecall;
976 968
 }
977 969
 
978 970
 function toggleVideo() {
@@ -1414,7 +1406,6 @@ function disposeConference(onUnload) {
1414 1406
     if(onUnload) {
1415 1407
         stopLocalRtpStatsCollector();
1416 1408
     }
1417
-    focus = null;
1418 1409
     activecall = null;
1419 1410
 }
1420 1411
 
@@ -1545,6 +1536,13 @@ function setView(viewName) {
1545 1536
 //    }
1546 1537
 }
1547 1538
 
1539
+$(document).bind('error.jingle',
1540
+    function (event, session, error)
1541
+    {
1542
+        console.error("Jingle error", error);
1543
+    }
1544
+);
1545
+
1548 1546
 $(document).bind('fatalError.jingle',
1549 1547
     function (event, session, error)
1550 1548
     {

+ 2
- 1
config.js Целия файл

@@ -4,7 +4,8 @@ var config = {
4 4
         //anonymousdomain: 'guest.example.com',
5 5
         muc: 'conference.jitsi-meet.example.com', // FIXME: use XEP-0030
6 6
         bridge: 'jitsi-videobridge.jitsi-meet.example.com', // FIXME: use XEP-0030
7
-        //call_control: 'callcontrol.jitsi-meet.example.com'
7
+        call_control: 'callcontrol.jitsi-meet.example.com',
8
+        focus: 'focus.jitsi-meet.example.com'
8 9
     },
9 10
 //  getroomnode: function (path) { return 'someprefixpossiblybasedonpath'; },
10 11
 //  useStunTurn: true, // use XEP-0215 to fetch STUN and TURN server

+ 9
- 0
libs/strophe/strophe.jingle.adapter.js Целия файл

@@ -356,6 +356,15 @@ TraceablePeerConnection.prototype.modifySources = function(successCallback) {
356 356
     });
357 357
     this.removessrc = [];
358 358
 
359
+    // FIXME:
360
+    // this was a hack for the situation when only one peer exists
361
+    // in the conference.
362
+    // check if still required and remove
363
+    if (sdp.media[0])
364
+        sdp.media[0] = sdp.media[0].replace('a=recvonly', 'a=sendrecv');
365
+    if (sdp.media[1])
366
+        sdp.media[1] = sdp.media[1].replace('a=recvonly', 'a=sendrecv');
367
+
359 368
     sdp.raw = sdp.session + sdp.media.join('');
360 369
     this.setRemoteDescription(new RTCSessionDescription({type: 'offer', sdp: sdp.raw}),
361 370
         function() {

+ 2
- 0
libs/strophe/strophe.jingle.session.js Целия файл

@@ -581,6 +581,8 @@ JingleSession.prototype.createdAnswer = function (sdp, provisional) {
581 581
                         reason: $(stanza).find('error :first')[0].tagName,
582 582
                     }:{};
583 583
                     error.source = 'answer';
584
+                    error.stanza = stanza;
585
+
584 586
                     $(document).trigger('error.jingle', [self.sid, error]);
585 587
                 },
586 588
                 10000);

+ 1
- 1
muc.js Целия файл

@@ -139,7 +139,7 @@ Strophe.addConnectionPlugin('emuc', {
139 139
             $(document).trigger('entered.muc', [from, member, pres]);
140 140
         }
141 141
         // Always trigger presence to update bindings
142
-        console.log('presence change from', from);
142
+        console.log('presence change from', from, pres);
143 143
         $(document).trigger('presence.muc', [from, member, pres]);
144 144
 
145 145
         // Trigger status message update

Loading…
Отказ
Запис