Minor formatting fixes.
This commit is contained in:
parent
84a8d00234
commit
71229bdba9
|
@ -1,3 +1,4 @@
|
|||
/* global $, $iq, config */
|
||||
var params = {};
|
||||
function getConfigParamsFromUrl() {
|
||||
if(!location.hash)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* global config */
|
||||
/**
|
||||
* Provides statistics for the local stream.
|
||||
*/
|
||||
|
@ -33,7 +34,7 @@ function timeDomainDataToAudioLevel(samples) {
|
|||
}
|
||||
|
||||
return parseFloat(((maxVolume - 127) / 128).toFixed(3));
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Animates audio level change
|
||||
|
@ -41,20 +42,16 @@ function timeDomainDataToAudioLevel(samples) {
|
|||
* @param lastLevel the last audio level
|
||||
* @returns {Number} the audio level to be set
|
||||
*/
|
||||
function animateLevel(newLevel, lastLevel)
|
||||
{
|
||||
function animateLevel(newLevel, lastLevel) {
|
||||
var value = 0;
|
||||
var diff = lastLevel - newLevel;
|
||||
if(diff > 0.2)
|
||||
{
|
||||
if(diff > 0.2) {
|
||||
value = lastLevel - 0.2;
|
||||
}
|
||||
else if(diff < -0.4)
|
||||
{
|
||||
else if(diff < -0.4) {
|
||||
value = lastLevel + 0.4;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
value = newLevel;
|
||||
}
|
||||
|
||||
|
@ -85,8 +82,8 @@ function LocalStatsCollector(stream, interval, statisticsService, eventEmitter)
|
|||
* Starts the collecting the statistics.
|
||||
*/
|
||||
LocalStatsCollector.prototype.start = function () {
|
||||
if (config.disableAudioLevels || !window.AudioContext
|
||||
|| RTCBrowserType.isTemasysPluginUsed())
|
||||
if (config.disableAudioLevels || !window.AudioContext ||
|
||||
RTCBrowserType.isTemasysPluginUsed())
|
||||
return;
|
||||
|
||||
var context = new AudioContext();
|
||||
|
@ -116,7 +113,6 @@ LocalStatsCollector.prototype.start = function () {
|
|||
},
|
||||
this.intervalMilis
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -49,8 +49,6 @@ PeerStats.bandwidth = {};
|
|||
*/
|
||||
PeerStats.bitrate = {};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The packet loss rate
|
||||
* @type {{}}
|
||||
|
@ -675,41 +673,34 @@ StatsCollector.prototype.processStatsReport = function () {
|
|||
/**
|
||||
* Stats processing logic.
|
||||
*/
|
||||
StatsCollector.prototype.processAudioLevelReport = function ()
|
||||
{
|
||||
if (!this.baselineAudioLevelsReport)
|
||||
{
|
||||
StatsCollector.prototype.processAudioLevelReport = function () {
|
||||
if (!this.baselineAudioLevelsReport) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (var idx in this.currentAudioLevelsReport)
|
||||
{
|
||||
for (var idx in this.currentAudioLevelsReport) {
|
||||
var now = this.currentAudioLevelsReport[idx];
|
||||
|
||||
if (now.type != 'ssrc')
|
||||
{
|
||||
if (now.type != 'ssrc') {
|
||||
continue;
|
||||
}
|
||||
|
||||
var before = this.baselineAudioLevelsReport[idx];
|
||||
if (!before)
|
||||
{
|
||||
if (!before) {
|
||||
console.warn(getStatValue(now, 'ssrc') + ' not enough data');
|
||||
continue;
|
||||
}
|
||||
|
||||
var ssrc = getStatValue(now, 'ssrc');
|
||||
var jid = APP.xmpp.getJidFromSSRC(ssrc);
|
||||
if (!jid)
|
||||
{
|
||||
if (!jid) {
|
||||
if((Date.now() - now.timestamp) < 3000)
|
||||
console.warn("No jid for ssrc: " + ssrc);
|
||||
continue;
|
||||
}
|
||||
|
||||
var jidStats = this.jid2stats[jid];
|
||||
if (!jidStats)
|
||||
{
|
||||
if (!jidStats) {
|
||||
jidStats = new PeerStats();
|
||||
this.jid2stats[jid] = jidStats;
|
||||
}
|
||||
|
@ -728,8 +719,7 @@ StatsCollector.prototype.processAudioLevelReport = function ()
|
|||
return;
|
||||
}
|
||||
|
||||
if (audioLevel)
|
||||
{
|
||||
if (audioLevel) {
|
||||
// TODO: can't find specs about what this value really is,
|
||||
// but it seems to vary between 0 and around 32k.
|
||||
audioLevel = audioLevel / 32767;
|
||||
|
@ -737,8 +727,5 @@ StatsCollector.prototype.processAudioLevelReport = function ()
|
|||
if(jid != APP.xmpp.myJid())
|
||||
this.eventEmitter.emit("statistics.audioLevel", jid, audioLevel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* global require, APP */
|
||||
/**
|
||||
* Created by hristo on 8/4/14.
|
||||
*/
|
||||
|
@ -15,19 +16,15 @@ var localStats = null;
|
|||
|
||||
var rtpStats = null;
|
||||
|
||||
function stopLocal()
|
||||
{
|
||||
if(localStats)
|
||||
{
|
||||
function stopLocal() {
|
||||
if (localStats) {
|
||||
localStats.stop();
|
||||
localStats = null;
|
||||
}
|
||||
}
|
||||
|
||||
function stopRemote()
|
||||
{
|
||||
if(rtpStats)
|
||||
{
|
||||
function stopRemote() {
|
||||
if (rtpStats) {
|
||||
rtpStats.stop();
|
||||
eventEmitter.emit("statistics.stop");
|
||||
rtpStats = null;
|
||||
|
@ -35,20 +32,18 @@ function stopRemote()
|
|||
}
|
||||
|
||||
function startRemoteStats (peerconnection) {
|
||||
if(rtpStats)
|
||||
{
|
||||
if (rtpStats) {
|
||||
rtpStats.stop();
|
||||
rtpStats = null;
|
||||
}
|
||||
|
||||
rtpStats = new RTPStats(peerconnection, 200, 2000, eventEmitter);
|
||||
rtpStats.start();
|
||||
}
|
||||
|
||||
function onStreamCreated(stream)
|
||||
{
|
||||
if(stream.getOriginalStream().getAudioTracks().length === 0)
|
||||
function onStreamCreated(stream) {
|
||||
if(stream.getOriginalStream().getAudioTracks().length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
localStats = new LocalStats(stream.getOriginalStream(), 200, statistics,
|
||||
eventEmitter);
|
||||
|
@ -64,9 +59,7 @@ function onDisposeConference(onUnload) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
var statistics =
|
||||
{
|
||||
var statistics = {
|
||||
/**
|
||||
* Indicates that this audio level is for local jid.
|
||||
* @type {string}
|
||||
|
@ -129,18 +122,17 @@ var statistics =
|
|||
});
|
||||
APP.xmpp.addListener(XMPPEvents.PEERCONNECTION_READY, function (session) {
|
||||
CallStats.init(session);
|
||||
})
|
||||
});
|
||||
APP.RTC.addListener(RTCEvents.AUDIO_MUTE, function (mute) {
|
||||
CallStats.sendMuteEvent(mute, "audio");
|
||||
});
|
||||
APP.xmpp.addListener(XMPPEvents.CONFERENCE_SETUP_FAILED, function () {
|
||||
CallStats.sendSetupFailedEvent();
|
||||
})
|
||||
});
|
||||
APP.RTC.addListener(RTCEvents.VIDEO_MUTE, function (mute) {
|
||||
CallStats.sendMuteEvent(mute, "video");
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* global $, require, config, interfaceConfig */
|
||||
var i18n = require("i18next-client");
|
||||
var languages = require("../../service/translation/languages");
|
||||
var Settings = require("../settings/Settings");
|
||||
|
@ -23,7 +24,6 @@ var defaultOptions = {
|
|||
fallbackOnNull: true,
|
||||
fallbackOnEmpty: true,
|
||||
useDataAttrOptions: true,
|
||||
defaultValueFromContent: false,
|
||||
app: interfaceConfig.APP_NAME,
|
||||
getAsync: false,
|
||||
defaultValueFromContent: false,
|
||||
|
@ -63,8 +63,7 @@ var defaultOptions = {
|
|||
// localStorageExpirationTime: 86400000 // in ms, default 1 week
|
||||
};
|
||||
|
||||
function initCompleted(t)
|
||||
{
|
||||
function initCompleted(t) {
|
||||
$("[data-i18n]").i18n();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global $, $iq, APP, config, connection, messageHandler,
|
||||
/* global $, $iq, APP, config, messageHandler,
|
||||
roomName, sessionTerminated, Strophe, Util */
|
||||
var XMPPEvents = require("../../service/xmpp/XMPPEvents");
|
||||
var Settings = require("../settings/Settings");
|
||||
|
@ -69,8 +69,8 @@ var Moderator = {
|
|||
function listener(event) {
|
||||
if (event.data && event.data.sessionId) {
|
||||
if (event.origin !== window.location.origin) {
|
||||
console.warn(
|
||||
"Ignoring sessionId from different origin: " + event.origin);
|
||||
console.warn("Ignoring sessionId from different origin: " +
|
||||
event.origin);
|
||||
return;
|
||||
}
|
||||
localStorage.setItem('sessionId', event.data.sessionId);
|
||||
|
@ -219,8 +219,7 @@ var Moderator = {
|
|||
|
||||
console.info("Authentication enabled: " + authenticationEnabled);
|
||||
|
||||
externalAuthEnabled
|
||||
= $(resultIq).find(
|
||||
externalAuthEnabled = $(resultIq).find(
|
||||
'>conference>property' +
|
||||
'[name=\'externalAuth\'][value=\'true\']').length > 0;
|
||||
|
||||
|
@ -333,7 +332,8 @@ var Moderator = {
|
|||
// Do not show in case of session invalid
|
||||
// which means just a retry
|
||||
if (!invalidSession) {
|
||||
eventEmitter.emit(XMPPEvents.FOCUS_DISCONNECTED, focusComponent, retrySec);
|
||||
eventEmitter.emit(XMPPEvents.FOCUS_DISCONNECTED,
|
||||
focusComponent, retrySec);
|
||||
}
|
||||
// Reset response timeout
|
||||
getNextTimeout(true);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global $, $iq, config, connection, focusMucJid, messageHandler, Moderator,
|
||||
/* global $, $iq, config, connection, focusMucJid, messageHandler,
|
||||
Toolbar, Util */
|
||||
var Moderator = require("./moderator");
|
||||
|
||||
|
@ -23,14 +23,6 @@ function setRecordingToken(token) {
|
|||
recordingToken = token;
|
||||
}
|
||||
|
||||
function setRecording(state, token, callback, connection) {
|
||||
if (useJirecon){
|
||||
setRecordingJirecon(state, token, callback, connection);
|
||||
} else {
|
||||
setRecordingColibri(state, token, callback, connection);
|
||||
}
|
||||
}
|
||||
|
||||
function setRecordingJirecon(state, token, callback, connection) {
|
||||
if (state == recordingEnabled){
|
||||
return;
|
||||
|
@ -93,6 +85,14 @@ function setRecordingColibri(state, token, callback, connection) {
|
|||
);
|
||||
}
|
||||
|
||||
function setRecording(state, token, callback, connection) {
|
||||
if (useJirecon){
|
||||
setRecordingJirecon(state, token, callback, connection);
|
||||
} else {
|
||||
setRecordingColibri(state, token, callback, connection);
|
||||
}
|
||||
}
|
||||
|
||||
var Recording = {
|
||||
toggleRecording: function (tokenEmptyCallback,
|
||||
startingCallback, startedCallback, connection) {
|
||||
|
@ -150,6 +150,6 @@ var Recording = {
|
|||
);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = Recording;
|
|
@ -5,8 +5,6 @@
|
|||
var XMPPEvents = require("../../service/xmpp/XMPPEvents");
|
||||
var Moderator = require("./moderator");
|
||||
|
||||
var bridgeIsDown = false;
|
||||
|
||||
module.exports = function(XMPP, eventEmitter) {
|
||||
Strophe.addConnectionPlugin('emuc', {
|
||||
connection: null,
|
||||
|
@ -20,18 +18,17 @@ module.exports = function(XMPP, eventEmitter) {
|
|||
isOwner: false,
|
||||
role: null,
|
||||
focusMucJid: null,
|
||||
bridgeIsDown: false,
|
||||
init: function (conn) {
|
||||
this.connection = conn;
|
||||
},
|
||||
initPresenceMap: function (myroomjid) {
|
||||
this.presMap['to'] = myroomjid;
|
||||
this.presMap['xns'] = 'http://jabber.org/protocol/muc';
|
||||
if (APP.RTC.localAudio && APP.RTC.localAudio.isMuted())
|
||||
{
|
||||
if (APP.RTC.localAudio && APP.RTC.localAudio.isMuted()) {
|
||||
this.addAudioInfoToPresence(true);
|
||||
}
|
||||
if (APP.RTC.localVideo && APP.RTC.localVideo.isMuted())
|
||||
{
|
||||
if (APP.RTC.localVideo && APP.RTC.localVideo.isMuted()) {
|
||||
this.addVideoInfoToPresence(true);
|
||||
}
|
||||
},
|
||||
|
@ -591,24 +588,22 @@ module.exports = function(XMPP, eventEmitter) {
|
|||
|
||||
Moderator.onMucMemberLeft(jid);
|
||||
},
|
||||
parsePresence: function (from, memeber, pres) {
|
||||
if($(pres).find(">bridgeIsDown").length > 0 && !bridgeIsDown) {
|
||||
bridgeIsDown = true;
|
||||
parsePresence: function (from, member, pres) {
|
||||
if($(pres).find(">bridgeIsDown").length > 0 && !this.bridgeIsDown) {
|
||||
this.bridgeIsDown = true;
|
||||
eventEmitter.emit(XMPPEvents.BRIDGE_DOWN);
|
||||
}
|
||||
|
||||
if(memeber.isFocus)
|
||||
if(member.isFocus)
|
||||
return;
|
||||
|
||||
var displayName = !config.displayJids
|
||||
? memeber.displayName : Strophe.getResourceFromJid(from);
|
||||
? member.displayName : Strophe.getResourceFromJid(from);
|
||||
|
||||
if (displayName && displayName.length > 0)
|
||||
{
|
||||
if (displayName && displayName.length > 0) {
|
||||
eventEmitter.emit(XMPPEvents.DISPLAY_NAME_CHANGED, from, displayName);
|
||||
}
|
||||
|
||||
|
||||
var id = $(pres).find('>userID').text();
|
||||
var email = $(pres).find('>email');
|
||||
if (email.length > 0) {
|
||||
|
|
|
@ -5,8 +5,7 @@ var XMPPEvents = require("../../service/xmpp/XMPPEvents");
|
|||
var RTCBrowserType = require("../RTC/RTCBrowserType");
|
||||
|
||||
|
||||
module.exports = function(XMPP, eventEmitter)
|
||||
{
|
||||
module.exports = function(XMPP, eventEmitter) {
|
||||
function CallIncomingJingle(sid, connection) {
|
||||
var sess = connection.jingle.sessions[sid];
|
||||
|
||||
|
@ -21,7 +20,7 @@ module.exports = function(XMPP, eventEmitter)
|
|||
sess.sendAnswer();
|
||||
sess.accept();
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
Strophe.addConnectionPlugin('jingle', {
|
||||
connection: null,
|
||||
|
@ -115,8 +114,7 @@ module.exports = function(XMPP, eventEmitter)
|
|||
switch (action) {
|
||||
case 'session-initiate':
|
||||
var startMuted = $(iq).find('jingle>startmuted');
|
||||
if (startMuted && startMuted.length > 0)
|
||||
{
|
||||
if (startMuted && startMuted.length > 0) {
|
||||
var audioMuted = startMuted.attr("audio");
|
||||
var videoMuted = startMuted.attr("video");
|
||||
eventEmitter.emit(XMPPEvents.START_MUTED_FROM_FOCUS,
|
||||
|
|
Loading…
Reference in New Issue