Fixes some issues related to xmpp module creation.
This commit is contained in:
parent
3da8e39745
commit
6347730dc7
14
index.html
14
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"/>
|
||||
|
|
|
@ -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 () {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -3827,31 +3827,32 @@ module.exports = function(XMPP, eventEmitter) {
|
|||
|
||||
var JingleSession = require("./JingleSession");
|
||||
|
||||
function CallIncomingJingle(sid, connection) {
|
||||
var sess = connection.jingle.sessions[sid];
|
||||
|
||||
// TODO: do we check activecall == null?
|
||||
activecall = 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();
|
||||
|
||||
};
|
||||
|
||||
module.exports = function(XMPP)
|
||||
{
|
||||
function CallIncomingJingle(sid, connection) {
|
||||
var sess = connection.jingle.sessions[sid];
|
||||
|
||||
// TODO: do we check activecall == null?
|
||||
connection.jingle.activecall = 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();
|
||||
|
||||
};
|
||||
|
||||
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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 () {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -2,31 +2,32 @@
|
|||
|
||||
var JingleSession = require("./JingleSession");
|
||||
|
||||
function CallIncomingJingle(sid, connection) {
|
||||
var sess = connection.jingle.sessions[sid];
|
||||
|
||||
// TODO: do we check activecall == null?
|
||||
activecall = 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();
|
||||
|
||||
};
|
||||
|
||||
module.exports = function(XMPP)
|
||||
{
|
||||
function CallIncomingJingle(sid, connection) {
|
||||
var sess = connection.jingle.sessions[sid];
|
||||
|
||||
// TODO: do we check activecall == null?
|
||||
connection.jingle.activecall = 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();
|
||||
|
||||
};
|
||||
|
||||
Strophe.addConnectionPlugin('jingle', {
|
||||
connection: null,
|
||||
sessions: {},
|
||||
jid2session: {},
|
||||
ice_config: {iceServers: []},
|
||||
pc_constraints: {},
|
||||
activecall: null,
|
||||
media_constraints: {
|
||||
mandatory: {
|
||||
'OfferToReceiveAudio': true,
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue