Skip to content

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

Cleanup: fixes to style, typos and documentation.

Boris Grozevbe6d7af37784
diff --git a/app.js b/app.js
index c2cd41a7c1..01beff5908 100644
--- a/app.js
+++ b/app.js
@@ -33,8 +33,8 @@ function init() {
$(document).ready(function () {
- var URLPRocessor = require("./modules/URLProcessor/URLProcessor");
- URLPRocessor.setConfigParametersFromUrl();
+ var URLProcessor = require("./modules/URLProcessor/URLProcessor");
+ URLProcessor.setConfigParametersFromUrl();
APP.init();
APP.translation.init();
diff --git a/external_api.js b/external_api.js
index 09bffb86e5..866f4d33d8 100644
--- a/external_api.js
+++ b/external_api.js
@@ -27,13 +27,15 @@ var JitsiMeetExternalAPI = (function()
*/
function JitsiMeetExternalAPI(domain, room_name, width, height, parent_node)
{
+ if(!width || width < MIN_WIDTH)
+ width = MIN_WIDTH;
+ if(!height || height < MIN_HEIGHT)
+ height = MIN_HEIGHT;
+
this.parentNode = null;
- if(parent_node)
- {
+ if(parent_node) {
this.parentNode = parent_node;
- }
- else
- {
+ } else {
var scriptTag = document.scripts[document.scripts.length - 1];
this.parentNode = scriptTag.parentNode;
}
@@ -41,10 +43,6 @@ var JitsiMeetExternalAPI = (function()
this.iframeHolder =
this.parentNode.appendChild(document.createElement("div"));
this.iframeHolder.id = "jitsiConference" + JitsiMeetExternalAPI.id;
- if(width < MIN_WIDTH)
- width = MIN_WIDTH;
- if(height < MIN_HEIGHT)
- height = MIN_HEIGHT;
this.iframeHolder.style.width = width + "px";
this.iframeHolder.style.height = height + "px";
this.frameName = "jitsiConferenceFrame" + JitsiMeetExternalAPI.id;
diff --git a/modules/RTC/LocalStream.js b/modules/RTC/LocalStream.js
index 333b1db75e..aa637290d5 100644
--- a/modules/RTC/LocalStream.js
+++ b/modules/RTC/LocalStream.js
@@ -93,13 +93,10 @@ LocalStream.prototype.setMute = function (mute)
LocalStream.prototype.isMuted = function () {
var tracks = [];
- if(this.type == "audio")
- {
+ if (this.isAudioStream()) {
tracks = this.stream.getAudioTracks();
- }
- else
- {
- if(this.stream.ended)
+ } else {
+ if (this.stream.ended)
return true;
tracks = this.stream.getVideoTracks();
}
@@ -108,7 +105,7 @@ LocalStream.prototype.isMuted = function () {
return false;
}
return true;
-}
+};
LocalStream.prototype.getId = function () {
return this.stream.getTracks()[0].id;
diff --git a/modules/xmpp/TraceablePeerConnection.js b/modules/xmpp/TraceablePeerConnection.js
index 295f7ff9c2..4970dd0c76 100644
--- a/modules/xmpp/TraceablePeerConnection.js
+++ b/modules/xmpp/TraceablePeerConnection.js
@@ -4,15 +4,15 @@ var XMPPEvents = require("../../service/xmpp/XMPPEvents");
function TraceablePeerConnection(ice_config, constraints, session) {
var self = this;
- var RTCPeerconnectionType = null;
+ var RTCPeerConnectionType = null;
if (RTCBrowserType.isFirefox()) {
- RTCPeerconnectionType = mozRTCPeerConnection;
+ RTCPeerConnectionType = mozRTCPeerConnection;
} else if (RTCBrowserType.isTemasysPluginUsed()) {
- RTCPeerconnectionType = RTCPeerConnection;
+ RTCPeerConnectionType = RTCPeerConnection;
} else {
- RTCPeerconnectionType = webkitRTCPeerConnection;
+ RTCPeerConnectionType = webkitRTCPeerConnection;
}
- this.peerconnection = new RTCPeerconnectionType(ice_config, constraints);
+ this.peerconnection = new RTCPeerConnectionType(ice_config, constraints);
this.updateLog = [];
this.stats = {};
this.statsinterval = null;
@@ -95,9 +95,8 @@ function TraceablePeerConnection(ice_config, constraints, session) {
this.statsinterval = window.setInterval(function() {
self.peerconnection.getStats(function(stats) {
var results = stats.result();
+ var now = new Date();
for (var i = 0; i < results.length; ++i) {
- //console.log(results[i].type, results[i].id, results[i].names())
- var now = new Date();
results[i].names().forEach(function (name) {
var id = results[i].id + '-' + name;
if (!self.stats[id]) {
@@ -121,9 +120,12 @@ function TraceablePeerConnection(ice_config, constraints, session) {
}, 1000);
}
-};
+}
-dumpSDP = function(description) {
+/**
+ * Returns a string representation of a SessionDescription object.
+ */
+var dumpSDP = function(description) {
if (typeof description === 'undefined' || description == null) {
return '';
}
@@ -135,7 +137,7 @@ dumpSDP = function(description) {
* Takes a SessionDescription object and returns a "normalized" version.
* Currently it only takes care of ordering the a=ssrc lines.
*/
-normalizePlanB = function(desc) {
+var normalizePlanB = function(desc) {
if (typeof desc !== 'object' || desc === null ||
typeof desc.sdp !== 'string') {
console.warn('An empty description was passed as an argument.');
@@ -199,30 +201,38 @@ normalizePlanB = function(desc) {
};
if (TraceablePeerConnection.prototype.__defineGetter__ !== undefined) {
- TraceablePeerConnection.prototype.__defineGetter__('signalingState', function() { return this.peerconnection.signalingState; });
- TraceablePeerConnection.prototype.__defineGetter__('iceConnectionState', function() { return this.peerconnection.iceConnectionState; });
- TraceablePeerConnection.prototype.__defineGetter__('localDescription', function() {
- var desc = this.peerconnection.localDescription;
- this.trace('getLocalDescription::preTransform', dumpSDP(desc));
-
- // if we're running on FF, transform to Plan B first.
- if (RTCBrowserType.usesUnifiedPlan()) {
- desc = this.interop.toPlanB(desc);
- this.trace('getLocalDescription::postTransform (Plan B)', dumpSDP(desc));
- }
- return desc;
- });
- TraceablePeerConnection.prototype.__defineGetter__('remoteDescription', function() {
- var desc = this.peerconnection.remoteDescription;
- this.trace('getRemoteDescription::preTransform', dumpSDP(desc));
-
- // if we're running on FF, transform to Plan B first.
- if (RTCBrowserType.usesUnifiedPlan()) {
- desc = this.interop.toPlanB(desc);
- this.trace('getRemoteDescription::postTransform (Plan B)', dumpSDP(desc));
- }
- return desc;
- });
+ TraceablePeerConnection.prototype.__defineGetter__(
+ 'signalingState',
+ function() { return this.peerconnection.signalingState; });
+ TraceablePeerConnection.prototype.__defineGetter__(
+ 'iceConnectionState',
+ function() { return this.peerconnection.iceConnectionState; });
+ TraceablePeerConnection.prototype.__defineGetter__(
+ 'localDescription',
+ function() {
+ var desc = this.peerconnection.localDescription;
+ this.trace('getLocalDescription::preTransform', dumpSDP(desc));
+
+ // if we're running on FF, transform to Plan B first.
+ if (RTCBrowserType.usesUnifiedPlan()) {
+ desc = this.interop.toPlanB(desc);
+ this.trace('getLocalDescription::postTransform (Plan B)', dumpSDP(desc));
+ }
+ return desc;
+ });
+ TraceablePeerConnection.prototype.__defineGetter__(
+ 'remoteDescription',
+ function() {
+ var desc = this.peerconnection.remoteDescription;
+ this.trace('getRemoteDescription::preTransform', dumpSDP(desc));
+
+ // if we're running on FF, transform to Plan B first.
+ if (RTCBrowserType.usesUnifiedPlan()) {
+ desc = this.interop.toPlanB(desc);
+ this.trace('getRemoteDescription::postTransform (Plan B)', dumpSDP(desc));
+ }
+ return desc;
+ });
}
TraceablePeerConnection.prototype.addStream = function (stream) {
@@ -234,7 +244,6 @@ TraceablePeerConnection.prototype.addStream = function (stream) {
catch (e)
{
console.error(e);
- return;
}
};
@@ -272,7 +281,8 @@ TraceablePeerConnection.prototype.createDataChannel = function (label, opts) {
return this.peerconnection.createDataChannel(label, opts);
};
-TraceablePeerConnection.prototype.setLocalDescription = function (description, successCallback, failureCallback) {
+TraceablePeerConnection.prototype.setLocalDescription
+ = function (description, successCallback, failureCallback) {
this.trace('setLocalDescription::preTransform', dumpSDP(description));
// if we're running on FF, transform to Plan A first.
if (RTCBrowserType.usesUnifiedPlan()) {
@@ -298,7 +308,8 @@ TraceablePeerConnection.prototype.setLocalDescription = function (description, s
*/
};
-TraceablePeerConnection.prototype.setRemoteDescription = function (description, successCallback, failureCallback) {
+TraceablePeerConnection.prototype.setRemoteDescription
+ = function (description, successCallback, failureCallback) {
this.trace('setRemoteDescription::preTransform', dumpSDP(description));
// TODO the focus should squeze or explode the remote simulcast
description = this.simulcast.mungeRemoteDescription(description);
@@ -341,7 +352,8 @@ TraceablePeerConnection.prototype.close = function () {
this.peerconnection.close();
};
-TraceablePeerConnection.prototype.createOffer = function (successCallback, failureCallback, constraints) {
+TraceablePeerConnection.prototype.createOffer
+ = function (successCallback, failureCallback, constraints) {
var self = this;
this.trace('createOffer', JSON.stringify(constraints, null, ' '));
this.peerconnection.createOffer(
@@ -369,20 +381,21 @@ TraceablePeerConnection.prototype.createOffer = function (successCallback, failu
);
};
-TraceablePeerConnection.prototype.createAnswer = function (successCallback, failureCallback, constraints) {
+TraceablePeerConnection.prototype.createAnswer
+ = function (successCallback, failureCallback, constraints) {
var self = this;
this.trace('createAnswer', JSON.stringify(constraints, null, ' '));
this.peerconnection.createAnswer(
function (answer) {
- self.trace('createAnswerOnSuccess::preTransfom', dumpSDP(answer));
+ self.trace('createAnswerOnSuccess::preTransform', dumpSDP(answer));
// if we're running on FF, transform to Plan A first.
if (RTCBrowserType.usesUnifiedPlan()) {
answer = self.interop.toPlanB(answer);
- self.trace('createAnswerOnSuccess::postTransfom (Plan B)', dumpSDP(answer));
+ self.trace('createAnswerOnSuccess::postTransform (Plan B)', dumpSDP(answer));
}
if (config.enableSimulcast && self.simulcast.isSupported()) {
answer = self.simulcast.mungeLocalDescription(answer);
- self.trace('createAnswerOnSuccess::postTransfom (simulcast)', dumpSDP(answer));
+ self.trace('createAnswerOnSuccess::postTransform (simulcast)', dumpSDP(answer));
}
successCallback(answer);
},
@@ -394,8 +407,9 @@ TraceablePeerConnection.prototype.createAnswer = function (successCallback, fail
);
};
-TraceablePeerConnection.prototype.addIceCandidate = function (candidate, successCallback, failureCallback) {
- var self = this;
+TraceablePeerConnection.prototype.addIceCandidate
+ = function (candidate, successCallback, failureCallback) {
+ //var self = this;
this.trace('addIceCandidate', JSON.stringify(candidate, null, ' '));
this.peerconnection.addIceCandidate(candidate);
/* maybe later
@@ -418,7 +432,7 @@ TraceablePeerConnection.prototype.getStats = function(callback, errback) {
// ignore for now...
if(!errback)
errback = function () {};
- this.peerconnection.getStats(null,callback,errback);
+ this.peerconnection.getStats(null, callback, errback);
} else {
this.peerconnection.getStats(callback);
}
diff --git a/modules/xmpp/xmpp.js b/modules/xmpp/xmpp.js
index 1957a1d13a..d8b57d7622 100644
--- a/modules/xmpp/xmpp.js
+++ b/modules/xmpp/xmpp.js
@@ -26,9 +26,6 @@ function connect(jid, password) {
connection = XMPP.createConnection();
Moderator.setConnection(connection);
- if (connection.disco) {
- // for chrome, add multistream cap
- }
connection.jingle.pc_constraints = APP.RTC.getPCConstraints();
if (config.useIPv6) {
// https://code.google.com/p/webrtc/issues/detail?id=2828
@@ -131,8 +128,8 @@ function connect(jid, password) {
// if we get disconnected from the XMPP server permanently.
// If the connection failed, retry.
- if (connectionFailed
- && faultTolerantConnect.retry("connection-failed")) {
+ if (connectionFailed &&
+ faultTolerantConnect.retry("connection-failed")) {
return;
}
@@ -151,11 +148,10 @@ function connect(jid, password) {
}
-
function maybeDoJoin() {
if (connection && connection.connected &&
- Strophe.getResourceFromJid(connection.jid)
- && (APP.RTC.localAudio || APP.RTC.localVideo)) {
+ Strophe.getResourceFromJid(connection.jid) &&
+ (APP.RTC.localAudio || APP.RTC.localVideo)) {
// .connected is true while connecting?
doJoin();
}
@@ -198,7 +194,8 @@ var unload = (function () {
async: false,
cache: false,
contentType: 'application/xml',
- data: "<body rid='" + (connection.rid || connection._proto.rid) +
+ data: "<body rid='" +
+ (connection.rid || connection._proto.rid) +
"' xmlns='http://jabber.org/protocol/httpbind' sid='" +
(connection.sid || connection._proto.sid) +
"' type='terminate'>" +
@@ -224,7 +221,7 @@ function setupEvents() {
// (change URL). If this participant doesn't unload properly, then it
// becomes a ghost for the rest of the participants that stay in the
// conference. Thankfully handling the 'unload' event in addition to the
- // 'beforeunload' event seems to garante the execution of the 'unload'
+ // 'beforeunload' event seems to guarantee the execution of the 'unload'
// method at least once.
//
// The 'unload' method can safely be run multiple times, it will actually do
@@ -274,10 +271,8 @@ var XMPP = {
promptLogin: function () {
eventEmitter.emit(XMPPEvents.PROMPT_FOR_LOGIN);
},
- joinRoom: function(roomName, useNicks, nick)
- {
- var roomjid;
- roomjid = roomName;
+ joinRoom: function(roomName, useNicks, nick) {
+ var roomjid = roomName;
if (useNicks) {
if (nick) {
@@ -286,7 +281,6 @@ var XMPP = {
roomjid += '/' + Strophe.getNodeFromJid(connection.jid);
}
} else {
-
var tmpJid = Strophe.getNodeFromJid(connection.jid);
if(!authenticatedUser)
@@ -323,14 +317,12 @@ var XMPP = {
}
eventEmitter.emit(XMPPEvents.DISPOSE_CONFERENCE, onUnload);
connection.jingle.activecall = null;
- if(!onUnload)
- {
+ if (!onUnload) {
this.sessionTerminated = true;
connection.emuc.doLeave();
}
},
- addListener: function(type, listener)
- {
+ addListener: function(type, listener) {
eventEmitter.on(type, listener);
},
removeListener: function (type, listener) {
@@ -398,7 +390,6 @@ var XMPP = {
return false;
}
-
if (this.forceMuted && !mute) {
console.info("Asking focus for unmute");
connection.moderate.setMute(connection.emuc.myroomjid, mute);
@@ -411,11 +402,7 @@ var XMPP = {
return true;
}
- // It is not clear what is the right way to handle multiple tracks.
- // So at least make sure that they are all muted or all unmuted and
- // that we send presence just once.
APP.RTC.localAudio.setMute(mute);
- // isMuted is the opposite of audioEnabled
this.sendAudioInfoPresence(mute, callback);
return true;
},
@@ -439,9 +426,11 @@ var XMPP = {
var sdp = new SDP(answer.sdp);
if (sdp.media.length > 1) {
if (unmute)
- sdp.media[1] = sdp.media[1].replace('a=recvonly', 'a=sendrecv');
+ sdp.media[1] = sdp.media[1].replace(
+ 'a=recvonly', 'a=sendrecv');
else
- sdp.media[1] = sdp.media[1].replace('a=sendrecv', 'a=recvonly');
+ sdp.media[1] = sdp.media[1].replace(
+ 'a=sendrecv', 'a=recvonly');
sdp.raw = sdp.session + sdp.media.join('');
answer.sdp = sdp.raw;
}
@@ -451,7 +440,8 @@ var XMPP = {
},
function (error) {
console.log('mute SLD error');
- eventEmitter.emit(XMPPEvents.SET_LOCAL_DESCRIPTION_ERROR);
+ eventEmitter.emit(
+ XMPPEvents.SET_LOCAL_DESCRIPTION_ERROR);
}
);
},
@@ -473,8 +463,7 @@ var XMPP = {
startingCallback, startedCallback, connection);
},
addToPresence: function (name, value, dontSend) {
- switch (name)
- {
+ switch (name) {
case "displayName":
connection.emuc.addDisplayNameToPresence(value);
break;