Browse Source

Minor formatting fixes.

master
Boris Grozev 10 years ago
parent
commit
71229bdba9

+ 1
- 0
modules/URLProcessor/URLProcessor.js View File

@@ -1,3 +1,4 @@
1
+/* global $, $iq, config */
1 2
 var params = {};
2 3
 function getConfigParamsFromUrl() {
3 4
     if(!location.hash)

+ 8
- 12
modules/statistics/LocalStatsCollector.js View File

@@ -1,3 +1,4 @@
1
+/* global config */
1 2
 /**
2 3
  * Provides statistics for the local stream.
3 4
  */
@@ -33,7 +34,7 @@ function timeDomainDataToAudioLevel(samples) {
33 34
     }
34 35
 
35 36
     return parseFloat(((maxVolume - 127) / 128).toFixed(3));
36
-};
37
+}
37 38
 
38 39
 /**
39 40
  * Animates audio level change
@@ -41,20 +42,16 @@ function timeDomainDataToAudioLevel(samples) {
41 42
  * @param lastLevel the last audio level
42 43
  * @returns {Number} the audio level to be set
43 44
  */
44
-function animateLevel(newLevel, lastLevel)
45
-{
45
+function animateLevel(newLevel, lastLevel) {
46 46
     var value = 0;
47 47
     var diff = lastLevel - newLevel;
48
-    if(diff > 0.2)
49
-    {
48
+    if(diff > 0.2) {
50 49
         value = lastLevel - 0.2;
51 50
     }
52
-    else if(diff < -0.4)
53
-    {
51
+    else if(diff < -0.4) {
54 52
         value = lastLevel + 0.4;
55 53
     }
56
-    else
57
-    {
54
+    else {
58 55
         value = newLevel;
59 56
     }
60 57
 
@@ -85,8 +82,8 @@ function LocalStatsCollector(stream, interval, statisticsService, eventEmitter)
85 82
  * Starts the collecting the statistics.
86 83
  */
87 84
 LocalStatsCollector.prototype.start = function () {
88
-    if (config.disableAudioLevels || !window.AudioContext
89
-        || RTCBrowserType.isTemasysPluginUsed())
85
+    if (config.disableAudioLevels || !window.AudioContext ||
86
+        RTCBrowserType.isTemasysPluginUsed())
90 87
         return;
91 88
 
92 89
     var context = new AudioContext();
@@ -116,7 +113,6 @@ LocalStatsCollector.prototype.start = function () {
116 113
         },
117 114
         this.intervalMilis
118 115
     );
119
-
120 116
 };
121 117
 
122 118
 /**

+ 9
- 22
modules/statistics/RTPStatsCollector.js View File

@@ -49,8 +49,6 @@ PeerStats.bandwidth = {};
49 49
  */
50 50
 PeerStats.bitrate = {};
51 51
 
52
-
53
-
54 52
 /**
55 53
  * The packet loss rate
56 54
  * @type {{}}
@@ -235,7 +233,7 @@ StatsCollector.prototype.errorCallback = function (error)
235 233
 StatsCollector.prototype.start = function ()
236 234
 {
237 235
     var self = this;
238
-    if(!config.disableAudioLevels) {
236
+    if (!config.disableAudioLevels) {
239 237
         this.audioLevelsIntervalId = setInterval(
240 238
             function () {
241 239
                 // Interval updates
@@ -675,41 +673,34 @@ StatsCollector.prototype.processStatsReport = function () {
675 673
 /**
676 674
  * Stats processing logic.
677 675
  */
678
-StatsCollector.prototype.processAudioLevelReport = function ()
679
-{
680
-    if (!this.baselineAudioLevelsReport)
681
-    {
676
+StatsCollector.prototype.processAudioLevelReport = function () {
677
+    if (!this.baselineAudioLevelsReport) {
682 678
         return;
683 679
     }
684 680
 
685
-    for (var idx in this.currentAudioLevelsReport)
686
-    {
681
+    for (var idx in this.currentAudioLevelsReport) {
687 682
         var now = this.currentAudioLevelsReport[idx];
688 683
 
689
-        if (now.type != 'ssrc')
690
-        {
684
+        if (now.type != 'ssrc') {
691 685
             continue;
692 686
         }
693 687
 
694 688
         var before = this.baselineAudioLevelsReport[idx];
695
-        if (!before)
696
-        {
689
+        if (!before) {
697 690
             console.warn(getStatValue(now, 'ssrc') + ' not enough data');
698 691
             continue;
699 692
         }
700 693
 
701 694
         var ssrc = getStatValue(now, 'ssrc');
702 695
         var jid = APP.xmpp.getJidFromSSRC(ssrc);
703
-        if (!jid)
704
-        {
696
+        if (!jid) {
705 697
             if((Date.now() - now.timestamp) < 3000)
706 698
                 console.warn("No jid for ssrc: " + ssrc);
707 699
             continue;
708 700
         }
709 701
 
710 702
         var jidStats = this.jid2stats[jid];
711
-        if (!jidStats)
712
-        {
703
+        if (!jidStats) {
713 704
             jidStats = new PeerStats();
714 705
             this.jid2stats[jid] = jidStats;
715 706
         }
@@ -728,8 +719,7 @@ StatsCollector.prototype.processAudioLevelReport = function ()
728 719
             return;
729 720
         }
730 721
 
731
-        if (audioLevel)
732
-        {
722
+        if (audioLevel) {
733 723
             // TODO: can't find specs about what this value really is,
734 724
             // but it seems to vary between 0 and around 32k.
735 725
             audioLevel = audioLevel / 32767;
@@ -737,8 +727,5 @@ StatsCollector.prototype.processAudioLevelReport = function ()
737 727
             if(jid != APP.xmpp.myJid())
738 728
                 this.eventEmitter.emit("statistics.audioLevel", jid, audioLevel);
739 729
         }
740
-
741 730
     }
742
-
743
-
744 731
 };

+ 12
- 20
modules/statistics/statistics.js View File

@@ -1,3 +1,4 @@
1
+/* global require, APP */
1 2
 /**
2 3
  * Created by hristo on 8/4/14.
3 4
  */
@@ -15,19 +16,15 @@ var localStats = null;
15 16
 
16 17
 var rtpStats = null;
17 18
 
18
-function stopLocal()
19
-{
20
-    if(localStats)
21
-    {
19
+function stopLocal() {
20
+    if (localStats) {
22 21
         localStats.stop();
23 22
         localStats = null;
24 23
     }
25 24
 }
26 25
 
27
-function stopRemote()
28
-{
29
-    if(rtpStats)
30
-    {
26
+function stopRemote() {
27
+    if (rtpStats) {
31 28
         rtpStats.stop();
32 29
         eventEmitter.emit("statistics.stop");
33 30
         rtpStats = null;
@@ -35,20 +32,18 @@ function stopRemote()
35 32
 }
36 33
 
37 34
 function startRemoteStats (peerconnection) {
38
-    if(rtpStats)
39
-    {
35
+    if (rtpStats) {
40 36
         rtpStats.stop();
41
-        rtpStats = null;
42 37
     }
43 38
 
44 39
     rtpStats = new RTPStats(peerconnection, 200, 2000, eventEmitter);
45 40
     rtpStats.start();
46 41
 }
47 42
 
48
-function onStreamCreated(stream)
49
-{
50
-    if(stream.getOriginalStream().getAudioTracks().length === 0)
43
+function onStreamCreated(stream) {
44
+    if(stream.getOriginalStream().getAudioTracks().length === 0) {
51 45
         return;
46
+    }
52 47
 
53 48
     localStats = new LocalStats(stream.getOriginalStream(), 200, statistics,
54 49
         eventEmitter);
@@ -64,9 +59,7 @@ function onDisposeConference(onUnload) {
64 59
     }
65 60
 }
66 61
 
67
-
68
-var statistics =
69
-{
62
+var statistics = {
70 63
     /**
71 64
      * Indicates that this audio level is for local jid.
72 65
      * @type {string}
@@ -129,18 +122,17 @@ var statistics =
129 122
         });
130 123
         APP.xmpp.addListener(XMPPEvents.PEERCONNECTION_READY, function (session) {
131 124
             CallStats.init(session);
132
-        })
125
+        });
133 126
         APP.RTC.addListener(RTCEvents.AUDIO_MUTE, function (mute) {
134 127
             CallStats.sendMuteEvent(mute, "audio");
135 128
         });
136 129
         APP.xmpp.addListener(XMPPEvents.CONFERENCE_SETUP_FAILED, function () {
137 130
             CallStats.sendSetupFailedEvent();
138
-        })
131
+        });
139 132
         APP.RTC.addListener(RTCEvents.VIDEO_MUTE, function (mute) {
140 133
             CallStats.sendMuteEvent(mute, "video");
141 134
         });
142 135
     }
143
-
144 136
 };
145 137
 
146 138
 

+ 2
- 3
modules/translation/translation.js View File

@@ -1,3 +1,4 @@
1
+/* global $, require, config, interfaceConfig */
1 2
 var i18n = require("i18next-client");
2 3
 var languages = require("../../service/translation/languages");
3 4
 var Settings = require("../settings/Settings");
@@ -23,7 +24,6 @@ var defaultOptions = {
23 24
     fallbackOnNull: true,
24 25
     fallbackOnEmpty: true,
25 26
     useDataAttrOptions: true,
26
-    defaultValueFromContent: false,
27 27
     app: interfaceConfig.APP_NAME,
28 28
     getAsync: false,
29 29
     defaultValueFromContent: false,
@@ -63,8 +63,7 @@ var defaultOptions = {
63 63
 //                localStorageExpirationTime: 86400000 // in ms, default 1 week
64 64
 };
65 65
 
66
-function initCompleted(t)
67
-{
66
+function initCompleted(t) {
68 67
     $("[data-i18n]").i18n();
69 68
 }
70 69
 

+ 6
- 6
modules/xmpp/moderator.js View File

@@ -1,4 +1,4 @@
1
-/* global $, $iq, APP, config, connection, messageHandler,
1
+/* global $, $iq, APP, config, messageHandler,
2 2
  roomName, sessionTerminated, Strophe, Util */
3 3
 var XMPPEvents = require("../../service/xmpp/XMPPEvents");
4 4
 var Settings = require("../settings/Settings");
@@ -69,8 +69,8 @@ var Moderator = {
69 69
         function listener(event) {
70 70
             if (event.data && event.data.sessionId) {
71 71
                 if (event.origin !== window.location.origin) {
72
-                    console.warn(
73
-                        "Ignoring sessionId from different origin: " + event.origin);
72
+                    console.warn("Ignoring sessionId from different origin: " +
73
+                        event.origin);
74 74
                     return;
75 75
                 }
76 76
                 localStorage.setItem('sessionId', event.data.sessionId);
@@ -219,8 +219,7 @@ var Moderator = {
219 219
 
220 220
         console.info("Authentication enabled: " + authenticationEnabled);
221 221
 
222
-        externalAuthEnabled
223
-            = $(resultIq).find(
222
+        externalAuthEnabled = $(resultIq).find(
224 223
                 '>conference>property' +
225 224
                 '[name=\'externalAuth\'][value=\'true\']').length > 0;
226 225
 
@@ -333,7 +332,8 @@ var Moderator = {
333 332
                 // Do not show in case of session invalid
334 333
                 // which means just a retry
335 334
                 if (!invalidSession) {
336
-                    eventEmitter.emit(XMPPEvents.FOCUS_DISCONNECTED, focusComponent, retrySec);
335
+                    eventEmitter.emit(XMPPEvents.FOCUS_DISCONNECTED,
336
+                        focusComponent, retrySec);
337 337
                 }
338 338
                 // Reset response timeout
339 339
                 getNextTimeout(true);

+ 10
- 10
modules/xmpp/recording.js View File

@@ -1,4 +1,4 @@
1
-/* global $, $iq, config, connection, focusMucJid, messageHandler, Moderator,
1
+/* global $, $iq, config, connection, focusMucJid, messageHandler,
2 2
    Toolbar, Util */
3 3
 var Moderator = require("./moderator");
4 4
 
@@ -23,14 +23,6 @@ function setRecordingToken(token) {
23 23
     recordingToken = token;
24 24
 }
25 25
 
26
-function setRecording(state, token, callback, connection) {
27
-    if (useJirecon){
28
-        setRecordingJirecon(state, token, callback, connection);
29
-    } else {
30
-        setRecordingColibri(state, token, callback, connection);
31
-    }
32
-}
33
-
34 26
 function setRecordingJirecon(state, token, callback, connection) {
35 27
     if (state == recordingEnabled){
36 28
         return;
@@ -93,6 +85,14 @@ function setRecordingColibri(state, token, callback, connection) {
93 85
     );
94 86
 }
95 87
 
88
+function setRecording(state, token, callback, connection) {
89
+    if (useJirecon){
90
+        setRecordingJirecon(state, token, callback, connection);
91
+    } else {
92
+        setRecordingColibri(state, token, callback, connection);
93
+    }
94
+}
95
+
96 96
 var Recording = {
97 97
     toggleRecording: function (tokenEmptyCallback,
98 98
                                startingCallback, startedCallback, connection) {
@@ -150,6 +150,6 @@ var Recording = {
150 150
         );
151 151
     }
152 152
 
153
-}
153
+};
154 154
 
155 155
 module.exports = Recording;

+ 10
- 15
modules/xmpp/strophe.emuc.js View File

@@ -5,8 +5,6 @@
5 5
 var XMPPEvents = require("../../service/xmpp/XMPPEvents");
6 6
 var Moderator = require("./moderator");
7 7
 
8
-var bridgeIsDown = false;
9
-
10 8
 module.exports = function(XMPP, eventEmitter) {
11 9
     Strophe.addConnectionPlugin('emuc', {
12 10
         connection: null,
@@ -20,18 +18,17 @@ module.exports = function(XMPP, eventEmitter) {
20 18
         isOwner: false,
21 19
         role: null,
22 20
         focusMucJid: null,
21
+        bridgeIsDown: false,
23 22
         init: function (conn) {
24 23
             this.connection = conn;
25 24
         },
26 25
         initPresenceMap: function (myroomjid) {
27 26
             this.presMap['to'] = myroomjid;
28 27
             this.presMap['xns'] = 'http://jabber.org/protocol/muc';
29
-            if (APP.RTC.localAudio && APP.RTC.localAudio.isMuted())
30
-            {
28
+            if (APP.RTC.localAudio && APP.RTC.localAudio.isMuted()) {
31 29
                 this.addAudioInfoToPresence(true);
32 30
             }
33
-            if (APP.RTC.localVideo && APP.RTC.localVideo.isMuted())
34
-            {
31
+            if (APP.RTC.localVideo && APP.RTC.localVideo.isMuted()) {
35 32
                 this.addVideoInfoToPresence(true);
36 33
             }
37 34
         },
@@ -591,27 +588,25 @@ module.exports = function(XMPP, eventEmitter) {
591 588
 
592 589
             Moderator.onMucMemberLeft(jid);
593 590
         },
594
-        parsePresence: function (from, memeber, pres) {
595
-            if($(pres).find(">bridgeIsDown").length > 0 && !bridgeIsDown) {
596
-                bridgeIsDown = true;
591
+        parsePresence: function (from, member, pres) {
592
+            if($(pres).find(">bridgeIsDown").length > 0 && !this.bridgeIsDown) {
593
+                this.bridgeIsDown = true;
597 594
                 eventEmitter.emit(XMPPEvents.BRIDGE_DOWN);
598 595
             }
599 596
 
600
-            if(memeber.isFocus)
597
+            if(member.isFocus)
601 598
                 return;
602 599
 
603 600
             var displayName = !config.displayJids
604
-                ? memeber.displayName : Strophe.getResourceFromJid(from);
601
+                ? member.displayName : Strophe.getResourceFromJid(from);
605 602
 
606
-            if (displayName && displayName.length > 0)
607
-            {
603
+            if (displayName && displayName.length > 0) {
608 604
                 eventEmitter.emit(XMPPEvents.DISPLAY_NAME_CHANGED, from, displayName);
609 605
             }
610 606
 
611
-
612 607
             var id = $(pres).find('>userID').text();
613 608
             var email = $(pres).find('>email');
614
-            if(email.length > 0) {
609
+            if (email.length > 0) {
615 610
                 id = email.text();
616 611
             }
617 612
 

+ 3
- 5
modules/xmpp/strophe.jingle.js View File

@@ -5,8 +5,7 @@ var XMPPEvents = require("../../service/xmpp/XMPPEvents");
5 5
 var RTCBrowserType = require("../RTC/RTCBrowserType");
6 6
 
7 7
 
8
-module.exports = function(XMPP, eventEmitter)
9
-{
8
+module.exports = function(XMPP, eventEmitter) {
10 9
     function CallIncomingJingle(sid, connection) {
11 10
         var sess = connection.jingle.sessions[sid];
12 11
 
@@ -21,7 +20,7 @@ module.exports = function(XMPP, eventEmitter)
21 20
         sess.sendAnswer();
22 21
         sess.accept();
23 22
 
24
-    };
23
+    }
25 24
 
26 25
     Strophe.addConnectionPlugin('jingle', {
27 26
         connection: null,
@@ -115,8 +114,7 @@ module.exports = function(XMPP, eventEmitter)
115 114
             switch (action) {
116 115
                 case 'session-initiate':
117 116
                     var startMuted = $(iq).find('jingle>startmuted');
118
-                    if (startMuted && startMuted.length > 0)
119
-                    {
117
+                    if (startMuted && startMuted.length > 0) {
120 118
                         var audioMuted = startMuted.attr("audio");
121 119
                         var videoMuted = startMuted.attr("video");
122 120
                         eventEmitter.emit(XMPPEvents.START_MUTED_FROM_FOCUS,

Loading…
Cancel
Save