Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Fixes some issues related to xmpp module creation.

hristoterezov6347730dc7bc
diff --git a/index.html b/index.html
index 2c4520ac1e..df7748e0af 100644
--- a/index.html
+++ b/index.html
@@ -25,19 +25,19 @@
<script src="service/RTC/MediaStreamTypes.js?v=1"></script>
<script src="service/xmpp/XMPPEvents.js?v=1"></script>
<script src="service/desktopsharing/DesktopSharingEventTypes.js?v=1"></script>
- <script src="libs/modules/simulcast.bundle.js?v=3"></script>
- <script src="libs/modules/connectionquality.bundle.js?v=1"></script>
- <script src="libs/modules/UI.bundle.js?v=5"></script>
- <script src="libs/modules/statistics.bundle.js?v=1"></script>
- <script src="libs/modules/RTC.bundle.js?v=4"></script>
+ <script src="libs/modules/simulcast.bundle.js?v=4"></script>
+ <script src="libs/modules/connectionquality.bundle.js?v=2"></script>
+ <script src="libs/modules/UI.bundle.js?v=6"></script>
+ <script src="libs/modules/statistics.bundle.js?v=2"></script>
+ <script src="libs/modules/RTC.bundle.js?v=5"></script>
<script src="libs/modules/desktopsharing.bundle.js?v=3"></script><!-- desktop sharing -->
<script src="util.js?v=7"></script><!-- utility functions -->
<script src="libs/modules/xmpp.bundle.js?v=1"></script>
- <script src="app.js?v=26"></script><!-- application logic -->
+ <script src="app.js?v=27"></script><!-- application logic -->
<script src="libs/modules/API.bundle.js?v=1"></script>
<script src="analytics.js?v=1"></script><!-- google analytics plugin -->
- <script src="keyboard_shortcut.js?v=4"></script>
+ <script src="keyboard_shortcut.js?v=5"></script>
<link rel="stylesheet" href="css/font.css?v=6"/>
<link rel="stylesheet" href="css/toastr.css?v=1">
<link rel="stylesheet" type="text/css" media="screen" href="css/main.css?v=30"/>
diff --git a/libs/modules/RTC.bundle.js b/libs/modules/RTC.bundle.js
index ee09d408aa..0a99925458 100644
--- a/libs/modules/RTC.bundle.js
+++ b/libs/modules/RTC.bundle.js
@@ -184,9 +184,9 @@ var DataChannels =
}
-function onSelectedEndpointChanged(userJid)
+function onSelectedEndpointChanged(userResource)
{
- console.log('selected endpoint changed: ', userJid);
+ console.log('selected endpoint changed: ', userResource);
if (_dataChannels && _dataChannels.length != 0)
{
_dataChannels.some(function (dataChannel) {
@@ -194,8 +194,9 @@ function onSelectedEndpointChanged(userJid)
{
dataChannel.send(JSON.stringify({
'colibriClass': 'SelectedEndpointChangedEvent',
- 'selectedEndpoint': (!userJid || userJid == null)
- ? null : userJid
+ 'selectedEndpoint':
+ (!userResource || userResource === null)?
+ null : userResource
}));
return true;
@@ -204,13 +205,13 @@ function onSelectedEndpointChanged(userJid)
}
}
-$(document).bind("selectedendpointchanged", function(event, userJid) {
- onSelectedEndpointChanged(userJid);
+$(document).bind("selectedendpointchanged", function(event, userResource) {
+ onSelectedEndpointChanged(userResource);
});
-function onPinnedEndpointChanged(userJid)
+function onPinnedEndpointChanged(userResource)
{
- console.log('pinned endpoint changed: ', userJid);
+ console.log('pinned endpoint changed: ', userResource);
if (_dataChannels && _dataChannels.length != 0)
{
_dataChannels.some(function (dataChannel) {
@@ -218,8 +219,9 @@ function onPinnedEndpointChanged(userJid)
{
dataChannel.send(JSON.stringify({
'colibriClass': 'PinnedEndpointChangedEvent',
- 'pinnedEndpoint': (!userJid || userJid == null)
- ? null : Strophe.getResourceFromJid(userJid)
+ 'pinnedEndpoint':
+ (!userResource || userResource == null)?
+ null : userResource
}));
return true;
@@ -228,8 +230,8 @@ function onPinnedEndpointChanged(userJid)
}
}
-$(document).bind("pinnedendpointchanged", function(event, userJid) {
- onPinnedEndpointChanged(userJid);
+$(document).bind("pinnedendpointchanged", function(event, userResource) {
+ onPinnedEndpointChanged(userResource);
});
module.exports = DataChannels;
@@ -339,7 +341,7 @@ module.exports = LocalStream;
*
* @constructor
*/
-function MediaStream(data, sid, ssrc, eventEmmiter, browser) {
+function MediaStream(data, sid, ssrc, browser) {
// XXX(gp) to minimize headaches in the future, we should build our
// abstractions around tracks and not streams. ORTC is track based API.
@@ -358,7 +360,6 @@ function MediaStream(data, sid, ssrc, eventEmmiter, browser) {
this.type = (this.stream.getVideoTracks().length > 0)?
MediaStreamType.VIDEO_TYPE : MediaStreamType.AUDIO_TYPE;
this.muted = false;
- eventEmmiter.emit(StreamEventTypes.EVENT_TYPE_REMOTE_CREATED, this);
if(browser == RTCBrowserType.RTC_BROWSER_FIREFOX)
{
if (!this.getVideoTracks)
@@ -442,13 +443,15 @@ var RTC = {
}
},
createRemoteStream: function (data, sid, thessrc) {
- var remoteStream = new MediaStream(data, sid, thessrc, eventEmitter,
+ var remoteStream = new MediaStream(data, sid, thessrc,
this.getBrowserType());
var jid = data.peerjid || xmpp.myJid();
if(!this.remoteStreams[jid]) {
this.remoteStreams[jid] = {};
}
this.remoteStreams[jid][remoteStream.type]= remoteStream;
+ eventEmitter.emit(StreamEventTypes.EVENT_TYPE_REMOTE_CREATED, remoteStream);
+ console.debug("ADD remote stream ", remoteStream.type, " ", jid, " ", thessrc);
return remoteStream;
},
getBrowserType: function () {
diff --git a/libs/modules/UI.bundle.js b/libs/modules/UI.bundle.js
index 7985aa2f06..ed15d086d9 100644
--- a/libs/modules/UI.bundle.js
+++ b/libs/modules/UI.bundle.js
@@ -6129,7 +6129,7 @@ var VideoLayout = (function (my) {
// picked up later by the lastN changed event handler.
lastNPickupJid = jid;
- $(document).trigger("pinnedendpointchanged", [jid]);
+ $(document).trigger("pinnedendpointchanged", [Strophe.getResourceFromJid(jid)]);
}
} else if (jid == xmpp.myJid()) {
$("#localVideoContainer").click();
diff --git a/libs/modules/simulcast.bundle.js b/libs/modules/simulcast.bundle.js
index d14fae45fa..9bdea9d449 100644
--- a/libs/modules/simulcast.bundle.js
+++ b/libs/modules/simulcast.bundle.js
@@ -219,7 +219,7 @@ SimulcastReceiver.prototype.getReceivingVideoStreamBySSRC = function (ssrc)
var sid, electedStream;
var i, j, k;
var jid = ssrc2jid[ssrc];
- if(jid)
+ if(jid && RTC.remoteStreams[jid])
{
var remoteStreamObject = RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE];
var remoteStream = remoteStreamObject.getOriginalStream();
@@ -239,6 +239,10 @@ SimulcastReceiver.prototype.getReceivingVideoStreamBySSRC = function (ssrc)
}
}
+ else
+ {
+ console.debug(RTC.remoteStreams, jid, ssrc);
+ }
return {
sid: sid,
diff --git a/libs/modules/xmpp.bundle.js b/libs/modules/xmpp.bundle.js
index 086d4d8d90..8c478a6414 100644
--- a/libs/modules/xmpp.bundle.js
+++ b/libs/modules/xmpp.bundle.js
@@ -3827,31 +3827,32 @@ module.exports = function(XMPP, eventEmitter) {
var JingleSession = require("./JingleSession");
-function CallIncomingJingle(sid, connection) {
- var sess = connection.jingle.sessions[sid];
+module.exports = function(XMPP)
+{
+ function CallIncomingJingle(sid, connection) {
+ var sess = connection.jingle.sessions[sid];
- // TODO: do we check activecall == null?
- activecall = sess;
+ // TODO: do we check activecall == null?
+ connection.jingle.activecall = sess;
- statistics.onConferenceCreated(sess);
- RTC.onConferenceCreated(sess);
+ statistics.onConferenceCreated(sess);
+ RTC.onConferenceCreated(sess);
- // TODO: check affiliation and/or role
- console.log('emuc data for', sess.peerjid, connection.emuc.members[sess.peerjid]);
- sess.usedrip = true; // not-so-naive trickle ice
- sess.sendAnswer();
- sess.accept();
+ // TODO: check affiliation and/or role
+ console.log('emuc data for', sess.peerjid, connection.emuc.members[sess.peerjid]);
+ sess.usedrip = true; // not-so-naive trickle ice
+ sess.sendAnswer();
+ sess.accept();
-};
+ };
-module.exports = function(XMPP)
-{
Strophe.addConnectionPlugin('jingle', {
connection: null,
sessions: {},
jid2session: {},
ice_config: {iceServers: []},
pc_constraints: {},
+ activecall: null,
media_constraints: {
mandatory: {
'OfferToReceiveAudio': true,
@@ -4389,7 +4390,6 @@ var SDP = require("./SDP");
var eventEmitter = new EventEmitter();
var connection = null;
var authenticatedUser = false;
-var activecall = null;
function connect(jid, password, uiCredentials) {
var bosh
@@ -4576,7 +4576,7 @@ var XMPP = {
},
disposeConference: function (onUnload) {
eventEmitter.emit(XMPPEvents.DISPOSE_CONFERENCE, onUnload);
- var handler = activecall;
+ var handler = connection.jingle.activecall;
if (handler && handler.peerconnection) {
// FIXME: probably removing streams is not required and close() should
// be enough
@@ -4588,7 +4588,7 @@ var XMPP = {
}
handler.peerconnection.close();
}
- activecall = null;
+ connection.jingle.activecall = null;
if(!onUnload)
{
this.sessionTerminated = true;
@@ -4615,9 +4615,9 @@ var XMPP = {
return Moderator.isExternalAuthEnabled();
},
switchStreams: function (stream, oldStream, callback) {
- if (activecall) {
+ if (connection && connection.jingle.activecall) {
// FIXME: will block switchInProgress on true value in case of exception
- activecall.switchStreams(stream, oldStream, callback);
+ connection.jingle.activecall.switchStreams(stream, oldStream, callback);
} else {
// We are done immediately
console.error("No conference handler");
@@ -4627,9 +4627,9 @@ var XMPP = {
}
},
setVideoMute: function (mute, callback, options) {
- if(activecall && connection && RTC.localVideo)
+ if(connection && RTC.localVideo && connection.jingle.activecall)
{
- activecall.setVideoMute(mute, callback, options);
+ connection.jingle.activecall.setVideoMute(mute, callback, options);
}
},
setAudioMute: function (mute, callback) {
@@ -4797,7 +4797,7 @@ var XMPP = {
connection.moderate.eject(jid);
},
findJidFromResource: function (resource) {
- connection.emuc.findJidFromResource(resource);
+ return connection.emuc.findJidFromResource(resource);
},
getMembers: function () {
return connection.emuc.members;
diff --git a/modules/RTC/DataChannels.js b/modules/RTC/DataChannels.js
index b9e74e9949..8cb75ae906 100644
--- a/modules/RTC/DataChannels.js
+++ b/modules/RTC/DataChannels.js
@@ -183,9 +183,9 @@ var DataChannels =
}
-function onSelectedEndpointChanged(userJid)
+function onSelectedEndpointChanged(userResource)
{
- console.log('selected endpoint changed: ', userJid);
+ console.log('selected endpoint changed: ', userResource);
if (_dataChannels && _dataChannels.length != 0)
{
_dataChannels.some(function (dataChannel) {
@@ -193,8 +193,9 @@ function onSelectedEndpointChanged(userJid)
{
dataChannel.send(JSON.stringify({
'colibriClass': 'SelectedEndpointChangedEvent',
- 'selectedEndpoint': (!userJid || userJid == null)
- ? null : userJid
+ 'selectedEndpoint':
+ (!userResource || userResource === null)?
+ null : userResource
}));
return true;
@@ -203,13 +204,13 @@ function onSelectedEndpointChanged(userJid)
}
}
-$(document).bind("selectedendpointchanged", function(event, userJid) {
- onSelectedEndpointChanged(userJid);
+$(document).bind("selectedendpointchanged", function(event, userResource) {
+ onSelectedEndpointChanged(userResource);
});
-function onPinnedEndpointChanged(userJid)
+function onPinnedEndpointChanged(userResource)
{
- console.log('pinned endpoint changed: ', userJid);
+ console.log('pinned endpoint changed: ', userResource);
if (_dataChannels && _dataChannels.length != 0)
{
_dataChannels.some(function (dataChannel) {
@@ -217,8 +218,9 @@ function onPinnedEndpointChanged(userJid)
{
dataChannel.send(JSON.stringify({
'colibriClass': 'PinnedEndpointChangedEvent',
- 'pinnedEndpoint': (!userJid || userJid == null)
- ? null : Strophe.getResourceFromJid(userJid)
+ 'pinnedEndpoint':
+ (!userResource || userResource == null)?
+ null : userResource
}));
return true;
@@ -227,8 +229,8 @@ function onPinnedEndpointChanged(userJid)
}
}
-$(document).bind("pinnedendpointchanged", function(event, userJid) {
- onPinnedEndpointChanged(userJid);
+$(document).bind("pinnedendpointchanged", function(event, userResource) {
+ onPinnedEndpointChanged(userResource);
});
module.exports = DataChannels;
diff --git a/modules/RTC/MediaStream.js b/modules/RTC/MediaStream.js
index cf1755d36e..222f013a3e 100644
--- a/modules/RTC/MediaStream.js
+++ b/modules/RTC/MediaStream.js
@@ -14,7 +14,7 @@
*
* @constructor
*/
-function MediaStream(data, sid, ssrc, eventEmmiter, browser) {
+function MediaStream(data, sid, ssrc, browser) {
// XXX(gp) to minimize headaches in the future, we should build our
// abstractions around tracks and not streams. ORTC is track based API.
@@ -33,7 +33,6 @@ function MediaStream(data, sid, ssrc, eventEmmiter, browser) {
this.type = (this.stream.getVideoTracks().length > 0)?
MediaStreamType.VIDEO_TYPE : MediaStreamType.AUDIO_TYPE;
this.muted = false;
- eventEmmiter.emit(StreamEventTypes.EVENT_TYPE_REMOTE_CREATED, this);
if(browser == RTCBrowserType.RTC_BROWSER_FIREFOX)
{
if (!this.getVideoTracks)
diff --git a/modules/RTC/RTC.js b/modules/RTC/RTC.js
index 9b269c8a4e..bc97c7f1f6 100644
--- a/modules/RTC/RTC.js
+++ b/modules/RTC/RTC.js
@@ -56,13 +56,15 @@ var RTC = {
}
},
createRemoteStream: function (data, sid, thessrc) {
- var remoteStream = new MediaStream(data, sid, thessrc, eventEmitter,
+ var remoteStream = new MediaStream(data, sid, thessrc,
this.getBrowserType());
var jid = data.peerjid || xmpp.myJid();
if(!this.remoteStreams[jid]) {
this.remoteStreams[jid] = {};
}
this.remoteStreams[jid][remoteStream.type]= remoteStream;
+ eventEmitter.emit(StreamEventTypes.EVENT_TYPE_REMOTE_CREATED, remoteStream);
+ console.debug("ADD remote stream ", remoteStream.type, " ", jid, " ", thessrc);
return remoteStream;
},
getBrowserType: function () {
diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.js
index 024755dd49..d6f6588432 100644
--- a/modules/UI/videolayout/VideoLayout.js
+++ b/modules/UI/videolayout/VideoLayout.js
@@ -1742,7 +1742,7 @@ var VideoLayout = (function (my) {
// picked up later by the lastN changed event handler.
lastNPickupJid = jid;
- $(document).trigger("pinnedendpointchanged", [jid]);
+ $(document).trigger("pinnedendpointchanged", [Strophe.getResourceFromJid(jid)]);
}
} else if (jid == xmpp.myJid()) {
$("#localVideoContainer").click();
diff --git a/modules/simulcast/SimulcastReceiver.js b/modules/simulcast/SimulcastReceiver.js
index c019a299f3..7b7387a735 100644
--- a/modules/simulcast/SimulcastReceiver.js
+++ b/modules/simulcast/SimulcastReceiver.js
@@ -185,7 +185,7 @@ SimulcastReceiver.prototype.getReceivingVideoStreamBySSRC = function (ssrc)
var sid, electedStream;
var i, j, k;
var jid = ssrc2jid[ssrc];
- if(jid)
+ if(jid && RTC.remoteStreams[jid])
{
var remoteStreamObject = RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE];
var remoteStream = remoteStreamObject.getOriginalStream();
@@ -205,6 +205,10 @@ SimulcastReceiver.prototype.getReceivingVideoStreamBySSRC = function (ssrc)
}
}
+ else
+ {
+ console.debug(RTC.remoteStreams, jid, ssrc);
+ }
return {
sid: sid,
diff --git a/modules/xmpp/strophe.jingle.js b/modules/xmpp/strophe.jingle.js
index 1f9534a026..fd6b6cdb21 100644
--- a/modules/xmpp/strophe.jingle.js
+++ b/modules/xmpp/strophe.jingle.js
@@ -2,31 +2,32 @@
var JingleSession = require("./JingleSession");
-function CallIncomingJingle(sid, connection) {
- var sess = connection.jingle.sessions[sid];
+module.exports = function(XMPP)
+{
+ function CallIncomingJingle(sid, connection) {
+ var sess = connection.jingle.sessions[sid];
- // TODO: do we check activecall == null?
- activecall = sess;
+ // TODO: do we check activecall == null?
+ connection.jingle.activecall = sess;
- statistics.onConferenceCreated(sess);
- RTC.onConferenceCreated(sess);
+ statistics.onConferenceCreated(sess);
+ RTC.onConferenceCreated(sess);
- // TODO: check affiliation and/or role
- console.log('emuc data for', sess.peerjid, connection.emuc.members[sess.peerjid]);
- sess.usedrip = true; // not-so-naive trickle ice
- sess.sendAnswer();
- sess.accept();
+ // TODO: check affiliation and/or role
+ console.log('emuc data for', sess.peerjid, connection.emuc.members[sess.peerjid]);
+ sess.usedrip = true; // not-so-naive trickle ice
+ sess.sendAnswer();
+ sess.accept();
-};
+ };
-module.exports = function(XMPP)
-{
Strophe.addConnectionPlugin('jingle', {
connection: null,
sessions: {},
jid2session: {},
ice_config: {iceServers: []},
pc_constraints: {},
+ activecall: null,
media_constraints: {
mandatory: {
'OfferToReceiveAudio': true,
diff --git a/modules/xmpp/xmpp.js b/modules/xmpp/xmpp.js
index fed7cddae7..8ce622727b 100644
--- a/modules/xmpp/xmpp.js
+++ b/modules/xmpp/xmpp.js
@@ -6,7 +6,6 @@ var SDP = require("./SDP");
var eventEmitter = new EventEmitter();
var connection = null;
var authenticatedUser = false;
-var activecall = null;
function connect(jid, password, uiCredentials) {
var bosh
@@ -193,7 +192,7 @@ var XMPP = {
},
disposeConference: function (onUnload) {
eventEmitter.emit(XMPPEvents.DISPOSE_CONFERENCE, onUnload);
- var handler = activecall;
+ var handler = connection.jingle.activecall;
if (handler && handler.peerconnection) {
// FIXME: probably removing streams is not required and close() should
// be enough
@@ -205,7 +204,7 @@ var XMPP = {
}
handler.peerconnection.close();
}
- activecall = null;
+ connection.jingle.activecall = null;
if(!onUnload)
{
this.sessionTerminated = true;
@@ -232,9 +231,9 @@ var XMPP = {
return Moderator.isExternalAuthEnabled();
},
switchStreams: function (stream, oldStream, callback) {
- if (activecall) {
+ if (connection && connection.jingle.activecall) {
// FIXME: will block switchInProgress on true value in case of exception
- activecall.switchStreams(stream, oldStream, callback);
+ connection.jingle.activecall.switchStreams(stream, oldStream, callback);
} else {
// We are done immediately
console.error("No conference handler");
@@ -244,9 +243,9 @@ var XMPP = {
}
},
setVideoMute: function (mute, callback, options) {
- if(activecall && connection && RTC.localVideo)
+ if(connection && RTC.localVideo && connection.jingle.activecall)
{
- activecall.setVideoMute(mute, callback, options);
+ connection.jingle.activecall.setVideoMute(mute, callback, options);
}
},
setAudioMute: function (mute, callback) {
@@ -414,7 +413,7 @@ var XMPP = {
connection.moderate.eject(jid);
},
findJidFromResource: function (resource) {
- connection.emuc.findJidFromResource(resource);
+ return connection.emuc.findJidFromResource(resource);
},
getMembers: function () {
return connection.emuc.members;