Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
Focus and debug changes
paweldomasf629ec17fa95
diff --git a/app.js b/app.jsindex 928c904360..05ff6372a6 100644--- a/app.js+++ b/app.js@@ -2,7 +2,6 @@/* application specific logic */var connection = null;var authenticatedUser = false;-var focus = null;var activecall = null;var RTC = null;var nickname = null;@@ -595,7 +594,7 @@ $(document).bind('conferenceCreated.jingle', function (event, focus)$(document).bind('callterminated.jingle', function (event, sid, jid, reason) {// Leave the room if my call has been remotely terminated.- if (connection.emuc.joined && focus == null && reason === 'kick') {+ if (connection.emuc.joined && reason === 'kick') {sessionTerminated = true;connection.emuc.doLeave();messageHandler.openMessageDialog("Session Terminated",@@ -677,7 +676,7 @@ $(document).bind('joined.muc', function (event, jid, info) {document.createTextNode(Strophe.getResourceFromJid(jid) + ' (me)'));- if (Object.keys(connection.emuc.members).length < 1) {+/* if (Object.keys(connection.emuc.members).length < 1) {focus = new ColibriFocus(connection, config.hosts.bridge);if (nickname !== null) {focus.setEndpointDisplayName(connection.emuc.myroomjid,@@ -694,7 +693,23 @@ $(document).bind('joined.muc', function (event, jid, info) {if (focus && config.etherpad_base) {Etherpad.init();- }+ }*/++ var elem = $iq({to: config.hosts.focus, type: 'set'});+ elem.c('conference', {+ xmlns: 'http://jitsi.org/protocol/focus',+ room: roomUrl.substr(roomUrl.lastIndexOf("/") + 1)+ });+ elem.up();++ connection.sendIQ(elem,+ function (result) {+ console.info("Focus replied ", result);+ },+ function (error) {+ console.warn(error);+ }+ );VideoLayout.showFocusIndicator();@@ -720,6 +735,12 @@ $(document).bind('entered.muc', function (event, jid, info, pres) {console.log('is focus? ' + (focus ? 'true' : 'false'));+ if (Strophe.getResourceFromJid(jid).indexOf('focus') != -1)+ {+ console.info("Ignore focus");+ return;+ }+// Add Peer's containerVideoLayout.ensurePeerContainerExists(jid);@@ -728,7 +749,7 @@ $(document).bind('entered.muc', function (event, jid, info, pres) {APIConnector.triggerEvent("participantJoined",{jid: jid});}- if (focus !== null) {+ /*if (focus !== null) {// FIXME: this should prepare the videoif (focus.confid === null) {console.log('make new conference with', jid);@@ -743,7 +764,7 @@ $(document).bind('entered.muc', function (event, jid, info, pres) {console.log('invite', jid, 'into conference');focus.addNewParticipant(jid);}- }+ }*/});$(document).bind('left.muc', function (event, jid) {@@ -784,41 +805,6 @@ $(document).bind('left.muc', function (event, jid) {connection.jingle.terminateByJid(jid);- if (focus == null- // I shouldn't be the one that left to enter here.- && jid !== connection.emuc.myroomjid- && connection.emuc.myroomjid === connection.emuc.list_members[0]- // If our session has been terminated for some reason- // (kicked, hangup), don't try to become the focus- && !sessionTerminated) {- console.log('welcome to our new focus... myself');- focus = new ColibriFocus(connection, config.hosts.bridge);- if (nickname !== null) {- focus.setEndpointDisplayName(connection.emuc.myroomjid,- nickname);- }-- Toolbar.showSipCallButton(true);-- if (Object.keys(connection.emuc.members).length > 0) {- focus.makeConference(Object.keys(connection.emuc.members));- Toolbar.showRecordingButton(true);- }- $(document).trigger('focusechanged.muc', [focus]);- }- else if (focus && Object.keys(connection.emuc.members).length === 0) {- console.log('everyone left');- // FIXME: closing the connection is a hack to avoid some- // problems with reinit- disposeConference();- focus = new ColibriFocus(connection, config.hosts.bridge);- if (nickname !== null) {- focus.setEndpointDisplayName(connection.emuc.myroomjid,- nickname);- }- Toolbar.showSipCallButton(true);- Toolbar.showRecordingButton(false);- }if (connection.emuc.getPrezi(jid)) {$(document).trigger('presentationremoved.muc',[jid, connection.emuc.getPrezi(jid)]);@@ -867,10 +853,16 @@ $(document).bind('presence.muc', function (event, jid, info, pres) {if (displayName && displayName.length > 0)$(document).trigger('displaynamechanged',[jid, displayName]);+ [jid, info.displayName]);+ if (Strophe.getResourceFromJid(jid).indexOf('focus') != -1)+ {+ console.info("Ignore focus");+ return;+ }- if (focus !== null && info.displayName !== null) {+ /*if (focus !== null && info.displayName !== null) {focus.setEndpointDisplayName(jid, info.displayName);- }+ }*///check if the video bridge is availableif($(pres).find(">bridgeIsDown").length > 0 && !bridgeIsDown) {@@ -972,7 +964,7 @@ function isVideoSrcDesktop(videoSrc) {}function getConferenceHandler() {- return focus ? focus : activecall;+ return activecall;}function toggleVideo() {@@ -1414,7 +1406,6 @@ function disposeConference(onUnload) {if(onUnload) {stopLocalRtpStatsCollector();}- focus = null;activecall = null;}@@ -1545,6 +1536,13 @@ function setView(viewName) {// }}+$(document).bind('error.jingle',+ function (event, session, error)+ {+ console.error("Jingle error", error);+ }+);+$(document).bind('fatalError.jingle',function (event, session, error){diff --git a/config.js b/config.jsindex c8a6fbeb66..009412d0a0 100644--- a/config.js+++ b/config.js@@ -4,7 +4,8 @@ var config = {//anonymousdomain: 'guest.example.com',muc: 'conference.jitsi-meet.example.com', // FIXME: use XEP-0030bridge: 'jitsi-videobridge.jitsi-meet.example.com', // FIXME: use XEP-0030- //call_control: 'callcontrol.jitsi-meet.example.com'+ call_control: 'callcontrol.jitsi-meet.example.com',+ focus: 'focus.jitsi-meet.example.com'},// getroomnode: function (path) { return 'someprefixpossiblybasedonpath'; },// useStunTurn: true, // use XEP-0215 to fetch STUN and TURN serverdiff --git a/libs/strophe/strophe.jingle.adapter.js b/libs/strophe/strophe.jingle.adapter.jsindex d0f4847f6c..5427db6749 100644--- a/libs/strophe/strophe.jingle.adapter.js+++ b/libs/strophe/strophe.jingle.adapter.js@@ -356,6 +356,15 @@ TraceablePeerConnection.prototype.modifySources = function(successCallback) {});this.removessrc = [];+ // FIXME:+ // this was a hack for the situation when only one peer exists+ // in the conference.+ // check if still required and remove+ if (sdp.media[0])+ sdp.media[0] = sdp.media[0].replace('a=recvonly', 'a=sendrecv');+ if (sdp.media[1])+ sdp.media[1] = sdp.media[1].replace('a=recvonly', 'a=sendrecv');+sdp.raw = sdp.session + sdp.media.join('');this.setRemoteDescription(new RTCSessionDescription({type: 'offer', sdp: sdp.raw}),function() {diff --git a/libs/strophe/strophe.jingle.session.js b/libs/strophe/strophe.jingle.session.jsindex 3b8515b209..c7faea66c1 100644--- a/libs/strophe/strophe.jingle.session.js+++ b/libs/strophe/strophe.jingle.session.js@@ -581,6 +581,8 @@ JingleSession.prototype.createdAnswer = function (sdp, provisional) {reason: $(stanza).find('error :first')[0].tagName,}:{};error.source = 'answer';+ error.stanza = stanza;+$(document).trigger('error.jingle', [self.sid, error]);},10000);diff --git a/muc.js b/muc.jsindex 0594613ee3..9ce52cff96 100644--- a/muc.js+++ b/muc.js@@ -139,7 +139,7 @@ Strophe.addConnectionPlugin('emuc', {$(document).trigger('entered.muc', [from, member, pres]);}// Always trigger presence to update bindings- console.log('presence change from', from);+ console.log('presence change from', from, pres);$(document).trigger('presence.muc', [from, member, pres]);// Trigger status message update