|
@@ -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
|
{
|