Browse Source

fix(eslint): Add no-multi-spaces rule

dev1
hristoterezov 8 years ago
parent
commit
c96898c478
42 changed files with 260 additions and 259 deletions
  1. 1
    0
      .eslintrc.js
  2. 20
    20
      JitsiConference.js
  3. 4
    4
      JitsiConferenceEventManager.js
  4. 2
    2
      JitsiConnection.js
  5. 1
    1
      JitsiMediaDevices.js
  6. 3
    3
      JitsiMeetJS.js
  7. 8
    8
      doc/example/example.js
  8. 8
    8
      modules/RTC/DataChannels.js
  9. 13
    13
      modules/RTC/JitsiLocalTrack.js
  10. 10
    10
      modules/RTC/JitsiRemoteTrack.js
  11. 10
    10
      modules/RTC/JitsiTrack.js
  12. 5
    5
      modules/RTC/RTC.js
  13. 1
    1
      modules/RTC/RTCBrowserType.js
  14. 7
    7
      modules/RTC/RTCUtils.js
  15. 7
    7
      modules/RTC/ScreenObtainer.js
  16. 2
    2
      modules/RTC/TraceablePeerConnection.js
  17. 3
    3
      modules/TalkMutedDetection.js
  18. 8
    8
      modules/connectivity/ConnectionQuality.js
  19. 3
    3
      modules/statistics/CallStats.js
  20. 4
    4
      modules/statistics/LocalStatsCollector.js
  21. 18
    18
      modules/statistics/RTPStatsCollector.js
  22. 18
    18
      modules/statistics/statistics.js
  23. 7
    7
      modules/transcription/audioRecorder.js
  24. 3
    3
      modules/transcription/transcriber.js
  25. 1
    1
      modules/transcription/transcriptionServices/AbstractTranscriptionService.js
  26. 3
    3
      modules/transcription/transcriptionServices/SphinxTranscriptionService.js
  27. 1
    1
      modules/util/EventEmitterForwarder.js
  28. 4
    4
      modules/util/GlobalOnErrorHandler.js
  29. 3
    3
      modules/util/ScriptUtil.js
  30. 1
    1
      modules/util/UsernameGenerator.js
  31. 1
    1
      modules/version/ComponentsVersions.js
  32. 1
    1
      modules/xmpp/Caps.js
  33. 23
    23
      modules/xmpp/ChatRoom.js
  34. 11
    11
      modules/xmpp/JingleSessionPC.js
  35. 1
    1
      modules/xmpp/RtxModifier.js
  36. 9
    9
      modules/xmpp/SDP.js
  37. 4
    4
      modules/xmpp/SDPDiffer.js
  38. 2
    2
      modules/xmpp/SDPUtil.js
  39. 11
    11
      modules/xmpp/moderator.js
  40. 9
    9
      modules/xmpp/recording.js
  41. 5
    5
      modules/xmpp/strophe.emuc.js
  42. 4
    4
      modules/xmpp/xmpp.js

+ 1
- 0
.eslintrc.js View File

76
         'complexity': 0,
76
         'complexity': 0,
77
         'consistent-return': 0,
77
         'consistent-return': 0,
78
         'curly': 2,
78
         'curly': 2,
79
+        'no-multi-spaces': 2,
79
 
80
 
80
         // Stylistic issues group
81
         // Stylistic issues group
81
         'brace-style': 2,
82
         'brace-style': 2,

+ 20
- 20
JitsiConference.js View File

94
  * @param connection {JitsiConnection} overrides this.connection
94
  * @param connection {JitsiConnection} overrides this.connection
95
  */
95
  */
96
 JitsiConference.prototype._init = function (options) {
96
 JitsiConference.prototype._init = function (options) {
97
-    if (!options)        {
97
+    if (!options) {
98
         options = {};
98
         options = {};
99
     }
99
     }
100
 
100
 
152
  * @param password {string} the password
152
  * @param password {string} the password
153
  */
153
  */
154
 JitsiConference.prototype.join = function (password) {
154
 JitsiConference.prototype.join = function (password) {
155
-    if (this.room)        {
155
+    if (this.room) {
156
         this.room.join(password);
156
         this.room.join(password);
157
     }
157
     }
158
 };
158
 };
177
     this.getLocalTracks().forEach(track => this.onLocalTrackRemoved(track));
177
     this.getLocalTracks().forEach(track => this.onLocalTrackRemoved(track));
178
 
178
 
179
     this.rtc.closeAllDataChannels();
179
     this.rtc.closeAllDataChannels();
180
-    if (this.statistics)        {
180
+    if (this.statistics) {
181
         this.statistics.dispose();
181
         this.statistics.dispose();
182
     }
182
     }
183
 
183
 
297
  * Note: consider adding eventing functionality by extending an EventEmitter impl, instead of rolling ourselves
297
  * Note: consider adding eventing functionality by extending an EventEmitter impl, instead of rolling ourselves
298
  */
298
  */
299
 JitsiConference.prototype.on = function (eventId, handler) {
299
 JitsiConference.prototype.on = function (eventId, handler) {
300
-    if (this.eventEmitter)        {
300
+    if (this.eventEmitter) {
301
         this.eventEmitter.on(eventId, handler);
301
         this.eventEmitter.on(eventId, handler);
302
     }
302
     }
303
 };
303
 };
310
  * Note: consider adding eventing functionality by extending an EventEmitter impl, instead of rolling ourselves
310
  * Note: consider adding eventing functionality by extending an EventEmitter impl, instead of rolling ourselves
311
  */
311
  */
312
 JitsiConference.prototype.off = function (eventId, handler) {
312
 JitsiConference.prototype.off = function (eventId, handler) {
313
-    if (this.eventEmitter)        {
313
+    if (this.eventEmitter) {
314
         this.eventEmitter.removeListener(eventId, handler);
314
         this.eventEmitter.removeListener(eventId, handler);
315
     }
315
     }
316
 };
316
 };
326
  * @param handler {Function} handler for the command
326
  * @param handler {Function} handler for the command
327
  */
327
  */
328
 JitsiConference.prototype.addCommandListener = function (command, handler) {
328
 JitsiConference.prototype.addCommandListener = function (command, handler) {
329
-    if (this.room)        {
329
+    if (this.room) {
330
         this.room.addPresenceListener(command, handler);
330
         this.room.addPresenceListener(command, handler);
331
     }
331
     }
332
 };
332
 };
336
   * @param command {String} the name of the command
336
   * @param command {String} the name of the command
337
   */
337
   */
338
 JitsiConference.prototype.removeCommandListener = function (command) {
338
 JitsiConference.prototype.removeCommandListener = function (command) {
339
-    if (this.room)        {
339
+    if (this.room) {
340
         this.room.removePresenceListener(command);
340
         this.room.removePresenceListener(command);
341
     }
341
     }
342
 };
342
 };
346
  * @param message the text message.
346
  * @param message the text message.
347
  */
347
  */
348
 JitsiConference.prototype.sendTextMessage = function (message) {
348
 JitsiConference.prototype.sendTextMessage = function (message) {
349
-    if (this.room)        {
349
+    if (this.room) {
350
         this.room.sendMessage(message);
350
         this.room.sendMessage(message);
351
     }
351
     }
352
 };
352
 };
378
  * @param name {String} the name of the command.
378
  * @param name {String} the name of the command.
379
  **/
379
  **/
380
 JitsiConference.prototype.removeCommand = function (name) {
380
 JitsiConference.prototype.removeCommand = function (name) {
381
-    if (this.room)        {
381
+    if (this.room) {
382
         this.room.removeFromPresence(name);
382
         this.room.removeFromPresence(name);
383
     }
383
     }
384
 };
384
 };
496
     // send event for stopping screen sharing
496
     // send event for stopping screen sharing
497
     // FIXME: we assume we have only one screen sharing track
497
     // FIXME: we assume we have only one screen sharing track
498
     // if we change this we need to fix this check
498
     // if we change this we need to fix this check
499
-    if (track.isVideoTrack() && track.videoType === VideoType.DESKTOP)        {
499
+    if (track.isVideoTrack() && track.videoType === VideoType.DESKTOP) {
500
         this.statistics.sendScreenSharingEvent(false);
500
         this.statistics.sendScreenSharingEvent(false);
501
     }
501
     }
502
 
502
 
635
     // send event for starting screen sharing
635
     // send event for starting screen sharing
636
     // FIXME: we assume we have only one screen sharing track
636
     // FIXME: we assume we have only one screen sharing track
637
     // if we change this we need to fix this check
637
     // if we change this we need to fix this check
638
-    if (newTrack.isVideoTrack() && newTrack.videoType === VideoType.DESKTOP)        {
638
+    if (newTrack.isVideoTrack() && newTrack.videoType === VideoType.DESKTOP) {
639
         this.statistics.sendScreenSharingEvent(true);
639
         this.statistics.sendScreenSharingEvent(true);
640
     }
640
     }
641
 
641
 
888
     }.bind(this));
888
     }.bind(this));
889
 
889
 
890
     // there can be no participant in case the member that left is focus
890
     // there can be no participant in case the member that left is focus
891
-    if (participant)        {
891
+    if (participant) {
892
         this.eventEmitter.emit(
892
         this.eventEmitter.emit(
893
             JitsiConferenceEvents.USER_LEFT, id, participant);
893
             JitsiConferenceEvents.USER_LEFT, id, participant);
894
     }
894
     }
911
         return;
911
         return;
912
     }
912
     }
913
 
913
 
914
-    if (participant._displayName === displayName)        {
914
+    if (participant._displayName === displayName) {
915
         return;
915
         return;
916
     }
916
     }
917
 
917
 
1230
  * Returns true if recording is supported and false if not.
1230
  * Returns true if recording is supported and false if not.
1231
  */
1231
  */
1232
 JitsiConference.prototype.isRecordingSupported = function () {
1232
 JitsiConference.prototype.isRecordingSupported = function () {
1233
-    if (this.room)        {
1233
+    if (this.room) {
1234
         return this.room.isRecordingSupported();
1234
         return this.room.isRecordingSupported();
1235
     }
1235
     }
1236
     return false;
1236
     return false;
1255
  * Starts/stops the recording
1255
  * Starts/stops the recording
1256
  */
1256
  */
1257
 JitsiConference.prototype.toggleRecording = function (options) {
1257
 JitsiConference.prototype.toggleRecording = function (options) {
1258
-    if (this.room)        {
1258
+    if (this.room) {
1259
         return this.room.toggleRecording(options, function (status, error) {
1259
         return this.room.toggleRecording(options, function (status, error) {
1260
             this.eventEmitter.emit(
1260
             this.eventEmitter.emit(
1261
                 JitsiConferenceEvents.RECORDER_STATE_CHANGED, status, error);
1261
                 JitsiConferenceEvents.RECORDER_STATE_CHANGED, status, error);
1270
  * Returns true if the SIP calls are supported and false otherwise
1270
  * Returns true if the SIP calls are supported and false otherwise
1271
  */
1271
  */
1272
 JitsiConference.prototype.isSIPCallingSupported = function () {
1272
 JitsiConference.prototype.isSIPCallingSupported = function () {
1273
-    if (this.room)        {
1273
+    if (this.room) {
1274
         return this.room.isSIPCallingSupported();
1274
         return this.room.isSIPCallingSupported();
1275
     }
1275
     }
1276
     return false;
1276
     return false;
1281
  * @param number the number
1281
  * @param number the number
1282
  */
1282
  */
1283
 JitsiConference.prototype.dial = function (number) {
1283
 JitsiConference.prototype.dial = function (number) {
1284
-    if (this.room)        {
1284
+    if (this.room) {
1285
         return this.room.dial(number);
1285
         return this.room.dial(number);
1286
     }
1286
     }
1287
     return new Promise(function(resolve, reject){
1287
     return new Promise(function(resolve, reject){
1293
  * Hangup an existing call
1293
  * Hangup an existing call
1294
  */
1294
  */
1295
 JitsiConference.prototype.hangup = function () {
1295
 JitsiConference.prototype.hangup = function () {
1296
-    if (this.room)        {
1296
+    if (this.room) {
1297
         return this.room.hangup();
1297
         return this.room.hangup();
1298
     }
1298
     }
1299
     return new Promise(function(resolve, reject){
1299
     return new Promise(function(resolve, reject){
1305
  * Returns the phone number for joining the conference.
1305
  * Returns the phone number for joining the conference.
1306
  */
1306
  */
1307
 JitsiConference.prototype.getPhoneNumber = function () {
1307
 JitsiConference.prototype.getPhoneNumber = function () {
1308
-    if (this.room)        {
1308
+    if (this.room) {
1309
         return this.room.getPhoneNumber();
1309
         return this.room.getPhoneNumber();
1310
     }
1310
     }
1311
     return null;
1311
     return null;
1315
  * Returns the pin for joining the conference with phone.
1315
  * Returns the pin for joining the conference with phone.
1316
  */
1316
  */
1317
 JitsiConference.prototype.getPhonePin = function () {
1317
 JitsiConference.prototype.getPhonePin = function () {
1318
-    if (this.room)        {
1318
+    if (this.room) {
1319
         return this.room.getPhonePin();
1319
         return this.room.getPhonePin();
1320
     }
1320
     }
1321
     return null;
1321
     return null;

+ 4
- 4
JitsiConferenceEventManager.js View File

23
     //Listeners related to the conference only
23
     //Listeners related to the conference only
24
     conference.on(JitsiConferenceEvents.TRACK_MUTE_CHANGED,
24
     conference.on(JitsiConferenceEvents.TRACK_MUTE_CHANGED,
25
         function (track) {
25
         function (track) {
26
-            if(!track.isLocal() || !conference.statistics)                {
26
+            if(!track.isLocal() || !conference.statistics) {
27
                 return;
27
                 return;
28
             }
28
             }
29
             conference.statistics.sendMuteEvent(track.isMuted(),
29
             conference.statistics.sendMuteEvent(track.isMuted(),
528
  */
528
  */
529
 JitsiConferenceEventManager.prototype.setupStatisticsListeners = function () {
529
 JitsiConferenceEventManager.prototype.setupStatisticsListeners = function () {
530
     var conference = this.conference;
530
     var conference = this.conference;
531
-    if(!conference.statistics)        {
531
+    if(!conference.statistics) {
532
         return;
532
         return;
533
     }
533
     }
534
 
534
 
535
     conference.statistics.addAudioLevelListener(function (ssrc, level) {
535
     conference.statistics.addAudioLevelListener(function (ssrc, level) {
536
         var resource = conference.rtc.getResourceBySSRC(ssrc);
536
         var resource = conference.rtc.getResourceBySSRC(ssrc);
537
-        if (!resource)            {
537
+        if (!resource) {
538
             return;
538
             return;
539
         }
539
         }
540
 
540
 
581
     conference.statistics.addByteSentStatsListener(function (stats) {
581
     conference.statistics.addByteSentStatsListener(function (stats) {
582
         conference.getLocalTracks(MediaType.AUDIO).forEach(function (track) {
582
         conference.getLocalTracks(MediaType.AUDIO).forEach(function (track) {
583
             const ssrc = track.getSSRC();
583
             const ssrc = track.getSSRC();
584
-            if (!ssrc || !stats.hasOwnProperty(ssrc))                {
584
+            if (!ssrc || !stats.hasOwnProperty(ssrc)) {
585
                 return;
585
                 return;
586
             }
586
             }
587
 
587
 

+ 2
- 2
JitsiConnection.js View File

29
             // we can see disconnects from normal tab closing of the browser
29
             // we can see disconnects from normal tab closing of the browser
30
             // and then there are no msgs, but we want to log only disconnects
30
             // and then there are no msgs, but we want to log only disconnects
31
             // when there is real error
31
             // when there is real error
32
-            if(msg)                {
32
+            if(msg) {
33
                 Statistics.analytics.sendEvent(
33
                 Statistics.analytics.sendEvent(
34
                     'connection.disconnected.' + msg);
34
                     'connection.disconnected.' + msg);
35
             }
35
             }
44
  * (for example authentications parameters).
44
  * (for example authentications parameters).
45
  */
45
  */
46
 JitsiConnection.prototype.connect = function (options) {
46
 JitsiConnection.prototype.connect = function (options) {
47
-    if(!options)        {
47
+    if(!options) {
48
         options = {};
48
         options = {};
49
     }
49
     }
50
 
50
 

+ 1
- 1
JitsiMediaDevices.js View File

100
     setAudioOutputDevice: function (deviceId) {
100
     setAudioOutputDevice: function (deviceId) {
101
 
101
 
102
         var availableDevices = RTC.getCurrentlyAvailableMediaDevices();
102
         var availableDevices = RTC.getCurrentlyAvailableMediaDevices();
103
-        if (availableDevices && availableDevices.length > 0)        {
103
+        if (availableDevices && availableDevices.length > 0) {
104
             // if we have devices info report device to stats
104
             // if we have devices info report device to stats
105
             // normally this will not happen on startup as this method is called
105
             // normally this will not happen on startup as this method is called
106
             // too early. This will happen only on user selection of new device
106
             // too early. This will happen only on user selection of new device

+ 3
- 3
JitsiMeetJS.js View File

31
 var USER_MEDIA_PERMISSION_PROMPT_TIMEOUT = 500;
31
 var USER_MEDIA_PERMISSION_PROMPT_TIMEOUT = 500;
32
 
32
 
33
 function getLowerResolution(resolution) {
33
 function getLowerResolution(resolution) {
34
-    if(!Resolutions[resolution])        {
34
+    if(!Resolutions[resolution]) {
35
         return null;
35
         return null;
36
     }
36
     }
37
     var order = Resolutions[resolution].order;
37
     var order = Resolutions[resolution].order;
224
             }, USER_MEDIA_PERMISSION_PROMPT_TIMEOUT);
224
             }, USER_MEDIA_PERMISSION_PROMPT_TIMEOUT);
225
         }
225
         }
226
 
226
 
227
-        if(!window.connectionTimes)            {
227
+        if(!window.connectionTimes) {
228
             window.connectionTimes = {};
228
             window.connectionTimes = {};
229
         }
229
         }
230
         window.connectionTimes["obtainPermissions.start"] =
230
         window.connectionTimes["obtainPermissions.start"] =
240
                 Statistics.analytics.sendEvent(addDeviceTypeToAnalyticsEvent(
240
                 Statistics.analytics.sendEvent(addDeviceTypeToAnalyticsEvent(
241
                     "getUserMedia.success", options), {value: options});
241
                     "getUserMedia.success", options), {value: options});
242
 
242
 
243
-                if(!RTC.options.disableAudioLevels)                    {
243
+                if(!RTC.options.disableAudioLevels) {
244
                     for(let i = 0; i < tracks.length; i++) {
244
                     for(let i = 0; i < tracks.length; i++) {
245
                         const track = tracks[i];
245
                         const track = tracks[i];
246
                         var mStream = track.getOriginalStream();
246
                         var mStream = track.getOriginalStream();

+ 8
- 8
doc/example/example.js View File

21
  */
21
  */
22
 function onLocalTracks(tracks){
22
 function onLocalTracks(tracks){
23
     localTracks = tracks;
23
     localTracks = tracks;
24
-    for(var i = 0; i < localTracks.length; i++)    {
24
+    for(var i = 0; i < localTracks.length; i++) {
25
         localTracks[i].addEventListener(JitsiMeetJS.events.track.TRACK_AUDIO_LEVEL_CHANGED,
25
         localTracks[i].addEventListener(JitsiMeetJS.events.track.TRACK_AUDIO_LEVEL_CHANGED,
26
             function (audioLevel) {
26
             function (audioLevel) {
27
                 console.log("Audio Level local: " + audioLevel);
27
                 console.log("Audio Level local: " + audioLevel);
45
             $("body").append("<audio autoplay='1' muted='true' id='localAudio" + i + "' />");
45
             $("body").append("<audio autoplay='1' muted='true' id='localAudio" + i + "' />");
46
             localTracks[i].attach($("#localAudio" + i)[0]);
46
             localTracks[i].attach($("#localAudio" + i)[0]);
47
         }
47
         }
48
-        if(isJoined)            {
48
+        if(isJoined) {
49
             room.addTrack(localTracks[i]);
49
             room.addTrack(localTracks[i]);
50
         }
50
         }
51
     }
51
     }
56
  * @param track JitsiTrack object
56
  * @param track JitsiTrack object
57
  */
57
  */
58
 function onRemoteTrack(track) {
58
 function onRemoteTrack(track) {
59
-    if(track.isLocal())        {
59
+    if(track.isLocal()) {
60
         return;
60
         return;
61
     }
61
     }
62
     var participant = track.getParticipantId();
62
     var participant = track.getParticipantId();
63
-    if(!remoteTracks[participant])        {
63
+    if(!remoteTracks[participant]) {
64
         remoteTracks[participant] = [];
64
         remoteTracks[participant] = [];
65
     }
65
     }
66
     var idx = remoteTracks[participant].push(track);
66
     var idx = remoteTracks[participant].push(track);
95
 function onConferenceJoined () {
95
 function onConferenceJoined () {
96
     console.log("conference joined!");
96
     console.log("conference joined!");
97
     isJoined = true;
97
     isJoined = true;
98
-    for(var i = 0; i < localTracks.length; i++)        {
98
+    for(var i = 0; i < localTracks.length; i++) {
99
         room.addTrack(localTracks[i]);
99
         room.addTrack(localTracks[i]);
100
     }
100
     }
101
 }
101
 }
102
 
102
 
103
 function onUserLeft(id) {
103
 function onUserLeft(id) {
104
     console.log("user left");
104
     console.log("user left");
105
-    if(!remoteTracks[id])        {
105
+    if(!remoteTracks[id]) {
106
         return;
106
         return;
107
     }
107
     }
108
     var tracks = remoteTracks[id];
108
     var tracks = remoteTracks[id];
109
-    for(var i = 0; i< tracks.length; i++)        {
109
+    for(var i = 0; i< tracks.length; i++) {
110
         tracks[i].detach($("#" + id + tracks[i].getType()));
110
         tracks[i].detach($("#" + id + tracks[i].getType()));
111
     }
111
     }
112
 }
112
 }
173
 }
173
 }
174
 
174
 
175
 function unload() {
175
 function unload() {
176
-    for(var i = 0; i < localTracks.length; i++)        {
176
+    for(var i = 0; i < localTracks.length; i++) {
177
         localTracks[i].stop();
177
         localTracks[i].stop();
178
     }
178
     }
179
     room.leave();
179
     room.leave();

+ 8
- 8
modules/RTC/DataChannels.js View File

76
 
76
 
77
         try {
77
         try {
78
             obj = JSON.parse(data);
78
             obj = JSON.parse(data);
79
-        }        catch (e) {
79
+        } catch (e) {
80
             GlobalOnErrorHandler.callErrorHandler(e);
80
             GlobalOnErrorHandler.callErrorHandler(e);
81
             logger.error(
81
             logger.error(
82
                 "Failed to parse data channel message as JSON: ",
82
                 "Failed to parse data channel message as JSON: ",
96
                     dominantSpeakerEndpoint);
96
                     dominantSpeakerEndpoint);
97
                 self.eventEmitter.emit(RTCEvents.DOMINANT_SPEAKER_CHANGED,
97
                 self.eventEmitter.emit(RTCEvents.DOMINANT_SPEAKER_CHANGED,
98
                   dominantSpeakerEndpoint);
98
                   dominantSpeakerEndpoint);
99
-            }            else if ("InLastNChangeEvent" === colibriClass) {
99
+            } else if ("InLastNChangeEvent" === colibriClass) {
100
                 var oldValue = obj.oldValue;
100
                 var oldValue = obj.oldValue;
101
                 var newValue = obj.newValue;
101
                 var newValue = obj.newValue;
102
 
102
 
119
                 }
119
                 }
120
 
120
 
121
                 self.eventEmitter.emit(RTCEvents.LASTN_CHANGED, oldValue, newValue);
121
                 self.eventEmitter.emit(RTCEvents.LASTN_CHANGED, oldValue, newValue);
122
-            }            else if ("LastNEndpointsChangeEvent" === colibriClass) {
122
+            } else if ("LastNEndpointsChangeEvent" === colibriClass) {
123
                 // The new/latest list of last-n endpoint IDs.
123
                 // The new/latest list of last-n endpoint IDs.
124
                 var lastNEndpoints = obj.lastNEndpoints;
124
                 var lastNEndpoints = obj.lastNEndpoints;
125
                 // The list of endpoint IDs which are entering the list of
125
                 // The list of endpoint IDs which are entering the list of
136
                 self.eventEmitter.emit(
136
                 self.eventEmitter.emit(
137
                     RTCEvents.ENDPOINT_MESSAGE_RECEIVED, obj.from,
137
                     RTCEvents.ENDPOINT_MESSAGE_RECEIVED, obj.from,
138
                     obj.msgPayload);
138
                     obj.msgPayload);
139
-            }            else if ("EndpointConnectivityStatusChangeEvent" === colibriClass) {
139
+            } else if ("EndpointConnectivityStatusChangeEvent" === colibriClass) {
140
                 var endpoint = obj.endpoint;
140
                 var endpoint = obj.endpoint;
141
                 var isActive = obj.active === "true";
141
                 var isActive = obj.active === "true";
142
                 logger.info("Endpoint connection status changed: " + endpoint
142
                 logger.info("Endpoint connection status changed: " + endpoint
143
                            + " active ? " + isActive);
143
                            + " active ? " + isActive);
144
                 self.eventEmitter.emit(RTCEvents.ENDPOINT_CONN_STATUS_CHANGED,
144
                 self.eventEmitter.emit(RTCEvents.ENDPOINT_CONN_STATUS_CHANGED,
145
                     endpoint, isActive);
145
                     endpoint, isActive);
146
-            }            else {
146
+            } else {
147
                 logger.debug("Data channel JSON-formatted message: ", obj);
147
                 logger.debug("Data channel JSON-formatted message: ", obj);
148
                 // The received message appears to be appropriately formatted
148
                 // The received message appears to be appropriately formatted
149
                 // (i.e. is a JSON object which assigns a value to the mandatory
149
                 // (i.e. is a JSON object which assigns a value to the mandatory
157
     dataChannel.onclose = function () {
157
     dataChannel.onclose = function () {
158
         logger.info("The Data Channel closed", dataChannel);
158
         logger.info("The Data Channel closed", dataChannel);
159
         var idx = self._dataChannels.indexOf(dataChannel);
159
         var idx = self._dataChannels.indexOf(dataChannel);
160
-        if (idx > -1)            {
160
+        if (idx > -1) {
161
             self._dataChannels = self._dataChannels.splice(idx, 1);
161
             self._dataChannels = self._dataChannels.splice(idx, 1);
162
         }
162
         }
163
     };
163
     };
235
     var dataChannels = this._dataChannels;
235
     var dataChannels = this._dataChannels;
236
 
236
 
237
     if (dataChannels && dataChannels.length !== 0) {
237
     if (dataChannels && dataChannels.length !== 0) {
238
-        if (thisArg)            {
238
+        if (thisArg) {
239
             return dataChannels.some(callback, thisArg);
239
             return dataChannels.some(callback, thisArg);
240
-        }        else            {
240
+        } else {
241
             return dataChannels.some(callback);
241
             return dataChannels.some(callback);
242
         }
242
         }
243
     } else {
243
     } else {

+ 13
- 13
modules/RTC/JitsiLocalTrack.js View File

34
     JitsiTrack.call(this,
34
     JitsiTrack.call(this,
35
         null /* RTC */, stream, track,
35
         null /* RTC */, stream, track,
36
         function () {
36
         function () {
37
-            if(!this.dontFireRemoveEvent)                {
37
+            if(!this.dontFireRemoveEvent) {
38
                 this.eventEmitter.emit(
38
                 this.eventEmitter.emit(
39
                     JitsiTrackEvents.LOCAL_TRACK_STOPPED);
39
                     JitsiTrackEvents.LOCAL_TRACK_STOPPED);
40
             }
40
             }
46
 
46
 
47
     // FIXME: currently firefox is ignoring our constraints about resolutions
47
     // FIXME: currently firefox is ignoring our constraints about resolutions
48
     // so we do not store it, to avoid wrong reporting of local track resolution
48
     // so we do not store it, to avoid wrong reporting of local track resolution
49
-    if (RTCBrowserType.isFirefox())        {
49
+    if (RTCBrowserType.isFirefox()) {
50
         this.resolution = null;
50
         this.resolution = null;
51
     }
51
     }
52
 
52
 
138
  * @returns {boolean}
138
  * @returns {boolean}
139
  */
139
  */
140
 JitsiLocalTrack.prototype.isEnded = function () {
140
 JitsiLocalTrack.prototype.isEnded = function () {
141
-    return  this.getTrack().readyState === 'ended' || this._trackEnded;
141
+    return this.getTrack().readyState === 'ended' || this._trackEnded;
142
 };
142
 };
143
 
143
 
144
 /**
144
 /**
184
  */
184
  */
185
 JitsiLocalTrack.prototype._onNoDataFromSourceError = function () {
185
 JitsiLocalTrack.prototype._onNoDataFromSourceError = function () {
186
     this._clearNoDataFromSourceMuteResources();
186
     this._clearNoDataFromSourceMuteResources();
187
-    if(this._checkForCameraIssues())        {
187
+    if(this._checkForCameraIssues()) {
188
         this._fireNoDataFromSourceEvent();
188
         this._fireNoDataFromSourceEvent();
189
     }
189
     }
190
 };
190
 };
295
     if (this.isAudioTrack() ||
295
     if (this.isAudioTrack() ||
296
         this.videoType === VideoType.DESKTOP ||
296
         this.videoType === VideoType.DESKTOP ||
297
         RTCBrowserType.isFirefox()) {
297
         RTCBrowserType.isFirefox()) {
298
-        if(this.track)            {
298
+        if(this.track) {
299
             this.track.enabled = !mute;
299
             this.track.enabled = !mute;
300
         }
300
         }
301
     } else {
301
     } else {
319
                 devices: [ MediaType.VIDEO ],
319
                 devices: [ MediaType.VIDEO ],
320
                 facingMode: this.getCameraFacingMode()
320
                 facingMode: this.getCameraFacingMode()
321
             };
321
             };
322
-            if (this.resolution)                {
322
+            if (this.resolution) {
323
                 streamOptions.resolution = this.resolution;
323
                 streamOptions.resolution = this.resolution;
324
             }
324
             }
325
 
325
 
479
  */
479
  */
480
 JitsiLocalTrack.prototype.isMuted = function () {
480
 JitsiLocalTrack.prototype.isMuted = function () {
481
     // this.stream will be null when we mute local video on Chrome
481
     // this.stream will be null when we mute local video on Chrome
482
-    if (!this.stream)        {
482
+    if (!this.stream) {
483
         return true;
483
         return true;
484
     }
484
     }
485
     if (this.isVideoTrack() && !this.isActive()) {
485
     if (this.isVideoTrack() && !this.isActive()) {
510
     // on "attach" call, but for local track we not always have the conference
510
     // on "attach" call, but for local track we not always have the conference
511
     // before attaching. However this may result in duplicated events if they
511
     // before attaching. However this may result in duplicated events if they
512
     // have been triggered on "attach" already.
512
     // have been triggered on "attach" already.
513
-    for(var i = 0; i < this.containers.length; i++)    {
513
+    for(var i = 0; i < this.containers.length; i++) {
514
         this._maybeFireTrackAttached(this.containers[i]);
514
         this._maybeFireTrackAttached(this.containers[i]);
515
     }
515
     }
516
 };
516
 };
523
  * @returns {string} or {null}
523
  * @returns {string} or {null}
524
  */
524
  */
525
 JitsiLocalTrack.prototype.getSSRC = function () {
525
 JitsiLocalTrack.prototype.getSSRC = function () {
526
-    if(this.ssrc && this.ssrc.groups && this.ssrc.groups.length)        {
526
+    if(this.ssrc && this.ssrc.groups && this.ssrc.groups.length) {
527
         return this.ssrc.groups[0].ssrcs[0];
527
         return this.ssrc.groups[0].ssrcs[0];
528
-    }    else if(this.ssrc && this.ssrc.ssrcs && this.ssrc.ssrcs.length)        {
528
+    } else if(this.ssrc && this.ssrc.ssrcs && this.ssrc.ssrcs.length) {
529
         return this.ssrc.ssrcs[0];
529
         return this.ssrc.ssrcs[0];
530
-    }    else        {
530
+    } else {
531
         return null;
531
         return null;
532
     }
532
     }
533
 };
533
 };
627
  */
627
  */
628
 JitsiLocalTrack.prototype._checkForCameraIssues = function () {
628
 JitsiLocalTrack.prototype._checkForCameraIssues = function () {
629
     if(!this.isVideoTrack() || this.stopStreamInProgress ||
629
     if(!this.isVideoTrack() || this.stopStreamInProgress ||
630
-        this.videoType === VideoType.DESKTOP)        {
630
+        this.videoType === VideoType.DESKTOP) {
631
         return false;
631
         return false;
632
     }
632
     }
633
 
633
 
644
  * @returns {boolean} true if the stream is receiving data and false otherwise.
644
  * @returns {boolean} true if the stream is receiving data and false otherwise.
645
  */
645
  */
646
 JitsiLocalTrack.prototype._isReceivingData = function () {
646
 JitsiLocalTrack.prototype._isReceivingData = function () {
647
-    if(!this.stream)        {
647
+    if(!this.stream) {
648
         return false;
648
         return false;
649
     }
649
     }
650
     // In older version of the spec there is no muted property and
650
     // In older version of the spec there is no muted property and

+ 10
- 10
modules/RTC/JitsiRemoteTrack.js View File

37
     // increase ttfm values
37
     // increase ttfm values
38
     this.hasBeenMuted = muted;
38
     this.hasBeenMuted = muted;
39
     // Bind 'onmute' and 'onunmute' event handlers
39
     // Bind 'onmute' and 'onunmute' event handlers
40
-    if (this.rtc && this.track)        {
40
+    if (this.rtc && this.track) {
41
         this._bindMuteHandlers();
41
         this._bindMuteHandlers();
42
     }
42
     }
43
 }
43
 }
77
  * @param value the muted status.
77
  * @param value the muted status.
78
  */
78
  */
79
 JitsiRemoteTrack.prototype.setMute = function (value) {
79
 JitsiRemoteTrack.prototype.setMute = function (value) {
80
-    if(this.muted === value)        {
80
+    if(this.muted === value) {
81
         return;
81
         return;
82
     }
82
     }
83
 
83
 
84
-    if(value)        {
84
+    if(value) {
85
         this.hasBeenMuted = true;
85
         this.hasBeenMuted = true;
86
     }
86
     }
87
 
87
 
88
     // we can have a fake video stream
88
     // we can have a fake video stream
89
-    if(this.stream)        {
89
+    if(this.stream) {
90
         this.stream.muted = value;
90
         this.stream.muted = value;
91
     }
91
     }
92
 
92
 
132
  * @param type the new video type("camera", "desktop")
132
  * @param type the new video type("camera", "desktop")
133
  */
133
  */
134
 JitsiRemoteTrack.prototype._setVideoType = function (type) {
134
 JitsiRemoteTrack.prototype._setVideoType = function (type) {
135
-    if(this.videoType === type)        {
135
+    if(this.videoType === type) {
136
         return;
136
         return;
137
     }
137
     }
138
     this.videoType = type;
138
     this.videoType = type;
154
     this.conference.getConnectionTimes()[type + ".ttfm"] = ttfm;
154
     this.conference.getConnectionTimes()[type + ".ttfm"] = ttfm;
155
     console.log("(TIME) TTFM " + type + ":\t", ttfm);
155
     console.log("(TIME) TTFM " + type + ":\t", ttfm);
156
     var eventName = type +'.ttfm';
156
     var eventName = type +'.ttfm';
157
-    if(this.hasBeenMuted)        {
157
+    if(this.hasBeenMuted) {
158
         eventName += '.muted';
158
         eventName += '.muted';
159
     }
159
     }
160
     Statistics.analytics.sendEvent(eventName, {value: ttfm});
160
     Statistics.analytics.sendEvent(eventName, {value: ttfm});
170
  */
170
  */
171
 JitsiRemoteTrack.prototype._attachTTFMTracker = function (container) {
171
 JitsiRemoteTrack.prototype._attachTTFMTracker = function (container) {
172
     if((ttfmTrackerAudioAttached && this.isAudioTrack())
172
     if((ttfmTrackerAudioAttached && this.isAudioTrack())
173
-        || (ttfmTrackerVideoAttached && this.isVideoTrack()))        {
173
+        || (ttfmTrackerVideoAttached && this.isVideoTrack())) {
174
         return;
174
         return;
175
     }
175
     }
176
 
176
 
177
-    if (this.isAudioTrack())        {
177
+    if (this.isAudioTrack()) {
178
         ttfmTrackerAudioAttached = true;
178
         ttfmTrackerAudioAttached = true;
179
     }
179
     }
180
-    if (this.isVideoTrack())        {
180
+    if (this.isVideoTrack()) {
181
         ttfmTrackerVideoAttached = true;
181
         ttfmTrackerVideoAttached = true;
182
     }
182
     }
183
 
183
 
188
 
188
 
189
         // FIXME: this is not working for IE11
189
         // FIXME: this is not working for IE11
190
         AdapterJS.addEvent(container, 'play', this._playCallback.bind(this));
190
         AdapterJS.addEvent(container, 'play', this._playCallback.bind(this));
191
-    }    else {
191
+    } else {
192
         container.addEventListener("canplay", this._playCallback.bind(this));
192
         container.addEventListener("canplay", this._playCallback.bind(this));
193
     }
193
     }
194
 };
194
 };

+ 10
- 10
modules/RTC/JitsiTrack.js View File

26
 function implementOnEndedHandling(jitsiTrack) {
26
 function implementOnEndedHandling(jitsiTrack) {
27
     var stream = jitsiTrack.getOriginalStream();
27
     var stream = jitsiTrack.getOriginalStream();
28
 
28
 
29
-    if(!stream)        {
29
+    if(!stream) {
30
         return;
30
         return;
31
     }
31
     }
32
 
32
 
46
  */
46
  */
47
 function addMediaStreamInactiveHandler(mediaStream, handler) {
47
 function addMediaStreamInactiveHandler(mediaStream, handler) {
48
     // Temasys will use onended
48
     // Temasys will use onended
49
-    if(typeof mediaStream.active !== "undefined")        {
49
+    if(typeof mediaStream.active !== "undefined") {
50
         mediaStream.oninactive = handler;
50
         mediaStream.oninactive = handler;
51
-    }    else        {
51
+    } else {
52
         mediaStream.onended = handler;
52
         mediaStream.onended = handler;
53
     }
53
     }
54
 }
54
 }
102
  */
102
  */
103
 JitsiTrack.prototype._setHandler = function (type, handler) {
103
 JitsiTrack.prototype._setHandler = function (type, handler) {
104
     this.handlers[type] = handler;
104
     this.handlers[type] = handler;
105
-    if(!this.stream)        {
105
+    if(!this.stream) {
106
         return;
106
         return;
107
     }
107
     }
108
 
108
 
317
  * @returns {string|null} id of the track or null if this is fake track.
317
  * @returns {string|null} id of the track or null if this is fake track.
318
  */
318
  */
319
 JitsiTrack.prototype.getId = function () {
319
 JitsiTrack.prototype.getId = function () {
320
-    if(this.stream)        {
320
+    if(this.stream) {
321
         return RTCUtils.getStreamID(this.stream);
321
         return RTCUtils.getStreamID(this.stream);
322
-    }    else        {
322
+    } else {
323
         return null;
323
         return null;
324
     }
324
     }
325
 };
325
 };
331
  * @returns {boolean} whether MediaStream is active.
331
  * @returns {boolean} whether MediaStream is active.
332
  */
332
  */
333
 JitsiTrack.prototype.isActive = function () {
333
 JitsiTrack.prototype.isActive = function () {
334
-    if(typeof this.stream.active !== "undefined")        {
334
+    if(typeof this.stream.active !== "undefined") {
335
         return this.stream.active;
335
         return this.stream.active;
336
-    }    else        {
336
+    } else {
337
         return true;
337
         return true;
338
     }
338
     }
339
 };
339
 };
345
  * @param handler handler for the event.
345
  * @param handler handler for the event.
346
  */
346
  */
347
 JitsiTrack.prototype.on = function (eventId, handler) {
347
 JitsiTrack.prototype.on = function (eventId, handler) {
348
-    if(this.eventEmitter)        {
348
+    if(this.eventEmitter) {
349
         this.eventEmitter.on(eventId, handler);
349
         this.eventEmitter.on(eventId, handler);
350
     }
350
     }
351
 };
351
 };
356
  * @param [handler] optional, the specific handler to unbind
356
  * @param [handler] optional, the specific handler to unbind
357
  */
357
  */
358
 JitsiTrack.prototype.off = function (eventId, handler) {
358
 JitsiTrack.prototype.off = function (eventId, handler) {
359
-    if(this.eventEmitter)        {
359
+    if(this.eventEmitter) {
360
         this.eventEmitter.removeListener(eventId, handler);
360
         this.eventEmitter.removeListener(eventId, handler);
361
     }
361
     }
362
 };
362
 };

+ 5
- 5
modules/RTC/RTC.js View File

164
     selectEndpoint (id) {
164
     selectEndpoint (id) {
165
         // cache the value if channel is missing, till we open it
165
         // cache the value if channel is missing, till we open it
166
         this.selectedEndpoint = id;
166
         this.selectedEndpoint = id;
167
-        if(this.dataChannels && this.dataChannelsOpen)            {
167
+        if(this.dataChannels && this.dataChannelsOpen) {
168
             this.dataChannels.sendSelectedEndpointMessage(id);
168
             this.dataChannels.sendSelectedEndpointMessage(id);
169
         }
169
         }
170
     }
170
     }
253
     }
253
     }
254
 
254
 
255
     addLocalTrack (track) {
255
     addLocalTrack (track) {
256
-        if (!track)            {
256
+        if (!track) {
257
             throw new Error('track must not be null nor undefined');
257
             throw new Error('track must not be null nor undefined');
258
         }
258
         }
259
 
259
 
334
      * @returns {JitsiRemoteTrack|null}
334
      * @returns {JitsiRemoteTrack|null}
335
      */
335
      */
336
     getRemoteTrackByType (type, resource) {
336
     getRemoteTrackByType (type, resource) {
337
-        if (this.remoteTracks[resource])            {
337
+        if (this.remoteTracks[resource]) {
338
             return this.remoteTracks[resource][type];
338
             return this.remoteTracks[resource][type];
339
-        }        else            {
339
+        } else {
340
             return null;
340
             return null;
341
         }
341
         }
342
     }
342
     }
637
     dispose () { }
637
     dispose () { }
638
 
638
 
639
     setAudioLevel (resource, audioLevel) {
639
     setAudioLevel (resource, audioLevel) {
640
-        if(!resource)            {
640
+        if(!resource) {
641
             return;
641
             return;
642
         }
642
         }
643
         var audioTrack = this.getRemoteAudioTrack(resource);
643
         var audioTrack = this.getRemoteAudioTrack(resource);

+ 1
- 1
modules/RTC/RTCBrowserType.js View File

335
     // Try all browser detectors
335
     // Try all browser detectors
336
     for (var i = 0; i < detectors.length; i++) {
336
     for (var i = 0; i < detectors.length; i++) {
337
         version = detectors[i]();
337
         version = detectors[i]();
338
-        if (version)            {
338
+        if (version) {
339
             return version;
339
             return version;
340
         }
340
         }
341
     }
341
     }

+ 7
- 7
modules/RTC/RTCUtils.js View File

107
     if (Resolutions[resolution]) {
107
     if (Resolutions[resolution]) {
108
         constraints.video.mandatory.minWidth = Resolutions[resolution].width;
108
         constraints.video.mandatory.minWidth = Resolutions[resolution].width;
109
         constraints.video.mandatory.minHeight = Resolutions[resolution].height;
109
         constraints.video.mandatory.minHeight = Resolutions[resolution].height;
110
-    }    else if (isAndroid) {
110
+    } else if (isAndroid) {
111
         // FIXME can't remember if the purpose of this was to always request
111
         // FIXME can't remember if the purpose of this was to always request
112
         //       low resolution on Android ? if yes it should be moved up front
112
         //       low resolution on Android ? if yes it should be moved up front
113
         constraints.video.mandatory.minWidth = 320;
113
         constraints.video.mandatory.minWidth = 320;
115
         constraints.video.mandatory.maxFrameRate = 15;
115
         constraints.video.mandatory.maxFrameRate = 15;
116
     }
116
     }
117
 
117
 
118
-    if (constraints.video.mandatory.minWidth)        {
118
+    if (constraints.video.mandatory.minWidth) {
119
         constraints.video.mandatory.maxWidth =
119
         constraints.video.mandatory.maxWidth =
120
             constraints.video.mandatory.minWidth;
120
             constraints.video.mandatory.minWidth;
121
     }
121
     }
122
-    if (constraints.video.mandatory.minHeight)        {
122
+    if (constraints.video.mandatory.minHeight) {
123
         constraints.video.mandatory.maxHeight =
123
         constraints.video.mandatory.maxHeight =
124
             constraints.video.mandatory.minHeight;
124
             constraints.video.mandatory.minHeight;
125
     }
125
     }
294
     // we turn audio for both audio and video tracks, the fake audio & video seems to work
294
     // we turn audio for both audio and video tracks, the fake audio & video seems to work
295
     // only when enabled in one getUserMedia call, we cannot get fake audio separate by fake video
295
     // only when enabled in one getUserMedia call, we cannot get fake audio separate by fake video
296
     // this later can be a problem with some of the tests
296
     // this later can be a problem with some of the tests
297
-    if(RTCBrowserType.isFirefox() && options.firefox_fake_device)    {
297
+    if(RTCBrowserType.isFirefox() && options.firefox_fake_device) {
298
         // seems to be fixed now, removing this experimental fix, as having
298
         // seems to be fixed now, removing this experimental fix, as having
299
         // multiple audio tracks brake the tests
299
         // multiple audio tracks brake the tests
300
         //constraints.audio = true;
300
         //constraints.audio = true;
771
                     // https://github.com/webrtc/samples/issues/302
771
                     // https://github.com/webrtc/samples/issues/302
772
                     if (element) {
772
                     if (element) {
773
                         defaultSetVideoSrc(element, stream);
773
                         defaultSetVideoSrc(element, stream);
774
-                        if (stream)                            {
774
+                        if (stream) {
775
                             element.play();
775
                             element.play();
776
                         }
776
                         }
777
                     }
777
                     }
1054
                             var videoTracksReceived = !!stream.getVideoTracks().length;
1054
                             var videoTracksReceived = !!stream.getVideoTracks().length;
1055
 
1055
 
1056
                             if((audioDeviceRequested && !audioTracksReceived) ||
1056
                             if((audioDeviceRequested && !audioTracksReceived) ||
1057
-                                (videoDeviceRequested && !videoTracksReceived))                            {
1057
+                                (videoDeviceRequested && !videoTracksReceived)) {
1058
                                 self.stopMediaStream(stream);
1058
                                 self.stopMediaStream(stream);
1059
 
1059
 
1060
                                 // We are getting here in case if we requested
1060
                                 // We are getting here in case if we requested
1144
     }
1144
     }
1145
 
1145
 
1146
     _isDeviceListAvailable () {
1146
     _isDeviceListAvailable () {
1147
-        if (!rtcReady)            {
1147
+        if (!rtcReady) {
1148
             throw new Error("WebRTC not ready yet");
1148
             throw new Error("WebRTC not ready yet");
1149
         }
1149
         }
1150
         var isEnumerateDevicesAvailable
1150
         var isEnumerateDevicesAvailable

+ 7
- 7
modules/RTC/ScreenObtainer.js View File

73
         this.options = options = options || {};
73
         this.options = options = options || {};
74
         gumFunction = gum;
74
         gumFunction = gum;
75
 
75
 
76
-        if (RTCBrowserType.isFirefox())            {
76
+        if (RTCBrowserType.isFirefox()) {
77
             initFirefoxExtensionDetection(options);
77
             initFirefoxExtensionDetection(options);
78
         }
78
         }
79
 
79
 
207
         if (firefoxExtInstalled === null) {
207
         if (firefoxExtInstalled === null) {
208
             window.setTimeout(
208
             window.setTimeout(
209
                 () => {
209
                 () => {
210
-                    if (firefoxExtInstalled === null)                        {
210
+                    if (firefoxExtInstalled === null) {
211
                         firefoxExtInstalled = false;
211
                         firefoxExtInstalled = false;
212
                     }
212
                     }
213
                     this.obtainScreenOnFirefox(callback, errorCallback);
213
                     this.obtainScreenOnFirefox(callback, errorCallback);
354
             var n1 = 0,
354
             var n1 = 0,
355
                 n2 = 0;
355
                 n2 = 0;
356
 
356
 
357
-            if (i < s1.length)                {
357
+            if (i < s1.length) {
358
                 n1 = parseInt(s1[i]);
358
                 n1 = parseInt(s1[i]);
359
             }
359
             }
360
-            if (i < s2.length)                {
360
+            if (i < s2.length) {
361
                 n2 = parseInt(s2[i]);
361
                 n2 = parseInt(s2[i]);
362
             }
362
             }
363
 
363
 
371
         // will happen if both versions have identical numbers in
371
         // will happen if both versions have identical numbers in
372
         // their components (even if one of them is longer, has more components)
372
         // their components (even if one of them is longer, has more components)
373
         return false;
373
         return false;
374
-    }    catch (e) {
374
+    } catch (e) {
375
         GlobalOnErrorHandler.callErrorHandler(e);
375
         GlobalOnErrorHandler.callErrorHandler(e);
376
         logger.error("Failed to parse extension version", e);
376
         logger.error("Failed to parse extension version", e);
377
         return true;
377
         return true;
512
         // As noted in Chrome Desktop Capture API:
512
         // As noted in Chrome Desktop Capture API:
513
         // If user didn't select any source (i.e. canceled the prompt)
513
         // If user didn't select any source (i.e. canceled the prompt)
514
         // then the callback is called with an empty streamId.
514
         // then the callback is called with an empty streamId.
515
-        if(response.streamId === "")        {
515
+        if(response.streamId === "") {
516
             onFailure(new JitsiTrackError(
516
             onFailure(new JitsiTrackError(
517
                 JitsiTrackErrors.CHROME_EXTENSION_USER_CANCELED));
517
                 JitsiTrackErrors.CHROME_EXTENSION_USER_CANCELED));
518
             return;
518
             return;
533
     if (options.desktopSharingFirefoxDisabled) {
533
     if (options.desktopSharingFirefoxDisabled) {
534
         return;
534
         return;
535
     }
535
     }
536
-    if (firefoxExtInstalled === false || firefoxExtInstalled === true)        {
536
+    if (firefoxExtInstalled === false || firefoxExtInstalled === true) {
537
         return;
537
         return;
538
     }
538
     }
539
     if (!options.desktopSharingFirefoxExtId) {
539
     if (!options.desktopSharingFirefoxExtId) {

+ 2
- 2
modules/RTC/TraceablePeerConnection.js View File

606
 
606
 
607
 TraceablePeerConnection.prototype.addStream = function (stream, ssrcInfo) {
607
 TraceablePeerConnection.prototype.addStream = function (stream, ssrcInfo) {
608
     this.trace('addStream', stream ? stream.id : "null");
608
     this.trace('addStream', stream ? stream.id : "null");
609
-    if (stream)        {
609
+    if (stream) {
610
         this.peerconnection.addStream(stream);
610
         this.peerconnection.addStream(stream);
611
     }
611
     }
612
     if (ssrcInfo && ssrcInfo.type === "addMuted") {
612
     if (ssrcInfo && ssrcInfo.type === "addMuted") {
913
             || RTCBrowserType.isTemasysPluginUsed()
913
             || RTCBrowserType.isTemasysPluginUsed()
914
             || RTCBrowserType.isReactNative()) {
914
             || RTCBrowserType.isReactNative()) {
915
         // ignore for now...
915
         // ignore for now...
916
-        if(!errback)            {
916
+        if(!errback) {
917
             errback = function () {};
917
             errback = function () {};
918
         }
918
         }
919
         this.peerconnection.getStats(null, callback, errback);
919
         this.peerconnection.getStats(null, callback, errback);

+ 3
- 3
modules/TalkMutedDetection.js View File

59
     _audioLevel(ssrc, audioLevel, isLocal) {
59
     _audioLevel(ssrc, audioLevel, isLocal) {
60
         // We are interested in the local audio stream only and if event is not
60
         // We are interested in the local audio stream only and if event is not
61
         // sent yet.
61
         // sent yet.
62
-        if (!isLocal || !this.audioTrack || this._eventFired)            {
62
+        if (!isLocal || !this.audioTrack || this._eventFired) {
63
             return;
63
             return;
64
         }
64
         }
65
 
65
 
92
      * @private
92
      * @private
93
      */
93
      */
94
     _trackAdded(track) {
94
     _trackAdded(track) {
95
-        if (this._isLocalAudioTrack(track))            {
95
+        if (this._isLocalAudioTrack(track)) {
96
             this.audioTrack = track;
96
             this.audioTrack = track;
97
         }
97
         }
98
     }
98
     }
106
      * @private
106
      * @private
107
      */
107
      */
108
     _trackMuteChanged(track) {
108
     _trackMuteChanged(track) {
109
-        if (this._isLocalAudioTrack(track) && track.isMuted())            {
109
+        if (this._isLocalAudioTrack(track) && track.isMuted()) {
110
             this._eventFired = false;
110
             this._eventFired = false;
111
         }
111
         }
112
     }
112
     }

+ 8
- 8
modules/connectivity/ConnectionQuality.js View File

21
  */
21
  */
22
 const kSimulcastFormats = [
22
 const kSimulcastFormats = [
23
     { width: 1920, height: 1080, layers:3, max: 5000, target: 4000, min: 800 },
23
     { width: 1920, height: 1080, layers:3, max: 5000, target: 4000, min: 800 },
24
-    { width: 1280, height: 720,  layers:3, max: 2500, target: 2500, min: 600 },
25
-    { width: 960,  height: 540,  layers:3, max: 900,  target: 900, min: 450 },
26
-    { width: 640,  height: 360,  layers:2, max: 700,  target: 500, min: 150 },
27
-    { width: 480,  height: 270,  layers:2, max: 450,  target: 350, min: 150 },
28
-    { width: 320,  height: 180,  layers:1, max: 200,  target: 150, min: 30 }
24
+    { width: 1280, height: 720, layers:3, max: 2500, target: 2500, min: 600 },
25
+    { width: 960, height: 540, layers:3, max: 900, target: 900, min: 450 },
26
+    { width: 640, height: 360, layers:2, max: 700, target: 500, min: 150 },
27
+    { width: 480, height: 270, layers:2, max: 450, target: 350, min: 150 },
28
+    { width: 320, height: 180, layers:1, max: 200, target: 150, min: 30 }
29
 ];
29
 ];
30
 
30
 
31
 /**
31
 /**
74
         if (pixels <= 320 * 240) {
74
         if (pixels <= 320 * 240) {
75
             target = 600;
75
             target = 600;
76
         } else if (pixels <= 640 * 480) {
76
         } else if (pixels <= 640 * 480) {
77
-            target =  1700;
77
+            target = 1700;
78
         } else if (pixels <= 960 * 540) {
78
         } else if (pixels <= 960 * 540) {
79
             target = 2000;
79
             target = 2000;
80
         } else {
80
         } else {
218
         conference.on(
218
         conference.on(
219
             ConferenceEvents.TRACK_ADDED,
219
             ConferenceEvents.TRACK_ADDED,
220
             (track) => {
220
             (track) => {
221
-                if (track.isVideoTrack() && !track.isMuted())                {
221
+                if (track.isVideoTrack() && !track.isMuted()) {
222
                     this._maybeUpdateUnmuteTime();
222
                     this._maybeUpdateUnmuteTime();
223
                 }
223
                 }
224
             });
224
             });
317
         }
317
         }
318
 
318
 
319
         // Make sure that the quality doesn't climb quickly
319
         // Make sure that the quality doesn't climb quickly
320
-        if (this._lastConnectionQualityUpdate > 0)        {
320
+        if (this._lastConnectionQualityUpdate > 0) {
321
             const maxIncreasePerSecond = 2;
321
             const maxIncreasePerSecond = 2;
322
             const prevConnectionQuality = this._localStats.connectionQuality;
322
             const prevConnectionQuality = this._localStats.connectionQuality;
323
             const diffSeconds
323
             const diffSeconds

+ 3
- 3
modules/statistics/CallStats.js View File

211
  */
211
  */
212
 CallStats._checkInitialize = function () {
212
 CallStats._checkInitialize = function () {
213
     if (CallStats.initialized || !CallStats.initializeFailed
213
     if (CallStats.initialized || !CallStats.initializeFailed
214
-        || !callStats || CallStats.initializeInProgress)        {
214
+        || !callStats || CallStats.initializeInProgress) {
215
         return;
215
         return;
216
     }
216
     }
217
 
217
 
236
 };
236
 };
237
 
237
 
238
 CallStats.prototype.pcCallback = _try_catch(function (err, msg) {
238
 CallStats.prototype.pcCallback = _try_catch(function (err, msg) {
239
-    if (callStats && err !== 'success')        {
239
+    if (callStats && err !== 'success') {
240
         logger.error("Monitoring status: "+ err + " msg: " + msg);
240
         logger.error("Monitoring status: "+ err + " msg: " + msg);
241
     }
241
     }
242
 });
242
 });
279
                 ssrc,
279
                 ssrc,
280
                 usageLabel,
280
                 usageLabel,
281
                 containerId);
281
                 containerId);
282
-        }        else {
282
+        } else {
283
             CallStats.reportsQueue.push({
283
             CallStats.reportsQueue.push({
284
                 type: reportType.MST_WITH_USERID,
284
                 type: reportType.MST_WITH_USERID,
285
                 data: {
285
                 data: {

+ 4
- 4
modules/statistics/LocalStatsCollector.js View File

46
     var length = samples.length;
46
     var length = samples.length;
47
 
47
 
48
     for (var i = 0; i < length; i++) {
48
     for (var i = 0; i < length; i++) {
49
-        if (maxVolume < samples[i])            {
49
+        if (maxVolume < samples[i]) {
50
             maxVolume = samples[i];
50
             maxVolume = samples[i];
51
         }
51
         }
52
     }
52
     }
65
     var diff = lastLevel - newLevel;
65
     var diff = lastLevel - newLevel;
66
     if(diff > 0.2) {
66
     if(diff > 0.2) {
67
         value = lastLevel - 0.2;
67
         value = lastLevel - 0.2;
68
-    }    else if(diff < -0.4) {
68
+    } else if(diff < -0.4) {
69
         value = lastLevel + 0.4;
69
         value = lastLevel + 0.4;
70
-    }    else {
70
+    } else {
71
         value = newLevel;
71
         value = newLevel;
72
     }
72
     }
73
 
73
 
96
  */
96
  */
97
 LocalStatsCollector.prototype.start = function () {
97
 LocalStatsCollector.prototype.start = function () {
98
     if (!context ||
98
     if (!context ||
99
-        RTCBrowserType.isTemasysPluginUsed())        {
99
+        RTCBrowserType.isTemasysPluginUsed()) {
100
         return;
100
         return;
101
     }
101
     }
102
     context.resume();
102
     context.resume();

+ 18
- 18
modules/statistics/RTPStatsCollector.js View File

64
  * @returns {number} packet loss percent
64
  * @returns {number} packet loss percent
65
  */
65
  */
66
 function calculatePacketLoss(lostPackets, totalPackets) {
66
 function calculatePacketLoss(lostPackets, totalPackets) {
67
-    if(!totalPackets || totalPackets <= 0 || !lostPackets || lostPackets <= 0)        {
67
+    if(!totalPackets || totalPackets <= 0 || !lostPackets || lostPackets <= 0) {
68
         return 0;
68
         return 0;
69
     }
69
     }
70
     return Math.round((lostPackets/totalPackets)*100);
70
     return Math.round((lostPackets/totalPackets)*100);
180
      */
180
      */
181
     this._browserType = RTCBrowserType.getBrowserType();
181
     this._browserType = RTCBrowserType.getBrowserType();
182
     var keys = KEYS_BY_BROWSER_TYPE[this._browserType];
182
     var keys = KEYS_BY_BROWSER_TYPE[this._browserType];
183
-    if (!keys)        {
183
+    if (!keys) {
184
         throw "The browser type '" + this._browserType + "' isn't supported!";
184
         throw "The browser type '" + this._browserType + "' isn't supported!";
185
     }
185
     }
186
     /**
186
     /**
252
                         if (!report || !report.result ||
252
                         if (!report || !report.result ||
253
                             typeof report.result != 'function') {
253
                             typeof report.result != 'function') {
254
                             results = report;
254
                             results = report;
255
-                        }                        else {
255
+                        } else {
256
                             results = report.result();
256
                             results = report.result();
257
                         }
257
                         }
258
                         self.currentAudioLevelsReport = results;
258
                         self.currentAudioLevelsReport = results;
278
                             typeof report.result != 'function') {
278
                             typeof report.result != 'function') {
279
                             //firefox
279
                             //firefox
280
                             results = report;
280
                             results = report;
281
-                        }                        else {
281
+                        } else {
282
                             //chrome
282
                             //chrome
283
                             results = report.result();
283
                             results = report.result();
284
                         }
284
                         }
285
                         self.currentStatsReport = results;
285
                         self.currentStatsReport = results;
286
                         try {
286
                         try {
287
                             self.processStatsReport();
287
                             self.processStatsReport();
288
-                        }                        catch (e) {
288
+                        } catch (e) {
289
                             GlobalOnErrorHandler.callErrorHandler(e);
289
                             GlobalOnErrorHandler.callErrorHandler(e);
290
                             logger.error("Unsupported key:" + e, e);
290
                             logger.error("Unsupported key:" + e, e);
291
                         }
291
                         }
314
     // RTCPeerConnection#getStats.
314
     // RTCPeerConnection#getStats.
315
     var keyFromName = function (name) {
315
     var keyFromName = function (name) {
316
         var key = keys[name];
316
         var key = keys[name];
317
-        if (key)            {
317
+        if (key) {
318
             return key;
318
             return key;
319
-        }        else            {
319
+        } else {
320
             throw "The property '" + name + "' isn't supported!";
320
             throw "The property '" + name + "' isn't supported!";
321
         }
321
         }
322
     };
322
     };
406
                     "upload": Math.round(sendBandwidth / 1000)
406
                     "upload": Math.round(sendBandwidth / 1000)
407
                 };
407
                 };
408
             }
408
             }
409
-        }        catch(e){/*not supported*/}
409
+        } catch(e){/*not supported*/}
410
 
410
 
411
-        if(now.type == 'googCandidatePair')        {
411
+        if(now.type == 'googCandidatePair') {
412
             var ip, type, localip, active;
412
             var ip, type, localip, active;
413
             try {
413
             try {
414
                 ip = getStatValue(now, 'remoteAddress');
414
                 ip = getStatValue(now, 'remoteAddress');
415
                 type = getStatValue(now, "transportType");
415
                 type = getStatValue(now, "transportType");
416
                 localip = getStatValue(now, "localAddress");
416
                 localip = getStatValue(now, "localAddress");
417
                 active = getStatValue(now, "activeConnection");
417
                 active = getStatValue(now, "activeConnection");
418
-            }            catch(e){/*not supported*/}
419
-            if(!ip || !type || !localip || active != "true")                {
418
+            } catch(e){/*not supported*/}
419
+            if(!ip || !type || !localip || active != "true") {
420
                 continue;
420
                 continue;
421
             }
421
             }
422
             // Save the address unless it has been saved already.
422
             // Save the address unless it has been saved already.
433
         }
433
         }
434
 
434
 
435
         if(now.type == "candidatepair") {
435
         if(now.type == "candidatepair") {
436
-            if(now.state == "succeeded")                {
436
+            if(now.state == "succeeded") {
437
                 continue;
437
                 continue;
438
             }
438
             }
439
 
439
 
473
                 continue;
473
                 continue;
474
             }
474
             }
475
         }
475
         }
476
-        if (!packetsNow || packetsNow < 0)            {
476
+        if (!packetsNow || packetsNow < 0) {
477
             packetsNow = 0;
477
             packetsNow = 0;
478
         }
478
         }
479
 
479
 
531
                 (width = getStatValue(now, "googFrameWidthReceived"))) {
531
                 (width = getStatValue(now, "googFrameWidthReceived"))) {
532
                 resolution.height = height;
532
                 resolution.height = height;
533
                 resolution.width = width;
533
                 resolution.width = width;
534
-            }            else if ((height = getStatValue(now, "googFrameHeightSent")) &&
534
+            } else if ((height = getStatValue(now, "googFrameHeightSent")) &&
535
                 (width = getStatValue(now, "googFrameWidthSent"))) {
535
                 (width = getStatValue(now, "googFrameWidthSent"))) {
536
                 resolution.height = height;
536
                 resolution.height = height;
537
                 resolution.width = width;
537
                 resolution.width = width;
538
             }
538
             }
539
-        }        catch(e){/*not supported*/}
539
+        } catch(e){/*not supported*/}
540
 
540
 
541
         if (resolution.height && resolution.width) {
541
         if (resolution.height && resolution.width) {
542
             ssrcStats.setResolution(resolution);
542
             ssrcStats.setResolution(resolution);
615
     for (var idx in this.currentAudioLevelsReport) {
615
     for (var idx in this.currentAudioLevelsReport) {
616
         var now = this.currentAudioLevelsReport[idx];
616
         var now = this.currentAudioLevelsReport[idx];
617
 
617
 
618
-        if (now.type != 'ssrc')            {
618
+        if (now.type != 'ssrc') {
619
             continue;
619
             continue;
620
         }
620
         }
621
 
621
 
627
         }
627
         }
628
 
628
 
629
         if (!ssrc) {
629
         if (!ssrc) {
630
-            if ((Date.now() - now.timestamp) < 3000)                {
630
+            if ((Date.now() - now.timestamp) < 3000) {
631
                 logger.warn("No ssrc: ");
631
                 logger.warn("No ssrc: ");
632
             }
632
             }
633
             continue;
633
             continue;
638
             var audioLevel
638
             var audioLevel
639
                 = getStatValue(now, 'audioInputLevel')
639
                 = getStatValue(now, 'audioInputLevel')
640
                     || getStatValue(now, 'audioOutputLevel');
640
                     || getStatValue(now, 'audioOutputLevel');
641
-        }        catch(e) {/*not supported*/
641
+        } catch(e) {/*not supported*/
642
             logger.warn("Audio Levels are not available in the statistics.");
642
             logger.warn("Audio Levels are not available in the statistics.");
643
             clearInterval(this.audioLevelsIntervalId);
643
             clearInterval(this.audioLevelsIntervalId);
644
             return;
644
             return;

+ 18
- 18
modules/statistics/statistics.js View File

89
             // of callstats.io may be disabled because of globally-disallowed
89
             // of callstats.io may be disabled because of globally-disallowed
90
             // requests to any third parties.
90
             // requests to any third parties.
91
             && (Statistics.disableThirdPartyRequests !== true);
91
             && (Statistics.disableThirdPartyRequests !== true);
92
-    if(this.callStatsIntegrationEnabled)        {
92
+    if(this.callStatsIntegrationEnabled) {
93
         loadCallStatsAPI(this.options.callStatsCustomScriptUrl);
93
         loadCallStatsAPI(this.options.callStatsCustomScriptUrl);
94
     }
94
     }
95
     this.callStats = null;
95
     this.callStats = null;
125
 Statistics.localStats = [];
125
 Statistics.localStats = [];
126
 
126
 
127
 Statistics.startLocalStats = function (stream, callback) {
127
 Statistics.startLocalStats = function (stream, callback) {
128
-    if(!Statistics.audioLevelsEnabled)        {
128
+    if(!Statistics.audioLevelsEnabled) {
129
         return;
129
         return;
130
     }
130
     }
131
     var localStats = new LocalStats(stream, Statistics.audioLevelsInterval,
131
     var localStats = new LocalStats(stream, Statistics.audioLevelsInterval,
135
 };
135
 };
136
 
136
 
137
 Statistics.prototype.addAudioLevelListener = function(listener) {
137
 Statistics.prototype.addAudioLevelListener = function(listener) {
138
-    if(!Statistics.audioLevelsEnabled)        {
138
+    if(!Statistics.audioLevelsEnabled) {
139
         return;
139
         return;
140
     }
140
     }
141
     this.eventEmitter.on(StatisticsEvents.AUDIO_LEVEL, listener);
141
     this.eventEmitter.on(StatisticsEvents.AUDIO_LEVEL, listener);
142
 };
142
 };
143
 
143
 
144
 Statistics.prototype.removeAudioLevelListener = function(listener) {
144
 Statistics.prototype.removeAudioLevelListener = function(listener) {
145
-    if(!Statistics.audioLevelsEnabled)        {
145
+    if(!Statistics.audioLevelsEnabled) {
146
         return;
146
         return;
147
     }
147
     }
148
     this.eventEmitter.removeListener(StatisticsEvents.AUDIO_LEVEL, listener);
148
     this.eventEmitter.removeListener(StatisticsEvents.AUDIO_LEVEL, listener);
180
     }
180
     }
181
     this.stopCallStats();
181
     this.stopCallStats();
182
     this.stopRemoteStats();
182
     this.stopRemoteStats();
183
-    if(this.eventEmitter)        {
183
+    if(this.eventEmitter) {
184
         this.eventEmitter.removeAllListeners();
184
         this.eventEmitter.removeAllListeners();
185
     }
185
     }
186
 };
186
 };
187
 
187
 
188
 Statistics.stopLocalStats = function (stream) {
188
 Statistics.stopLocalStats = function (stream) {
189
-    if(!Statistics.audioLevelsEnabled)        {
189
+    if(!Statistics.audioLevelsEnabled) {
190
         return;
190
         return;
191
     }
191
     }
192
 
192
 
193
-    for(var i = 0; i < Statistics.localStats.length; i++)        {
193
+    for(var i = 0; i < Statistics.localStats.length; i++) {
194
         if(Statistics.localStats[i].stream === stream){
194
         if(Statistics.localStats[i].stream === stream){
195
             var localStats = Statistics.localStats.splice(i, 1);
195
             var localStats = Statistics.localStats.splice(i, 1);
196
             localStats[0].stop();
196
             localStats[0].stop();
230
 Statistics.prototype.stopCallStats = function () {
230
 Statistics.prototype.stopCallStats = function () {
231
     if(this.callStatsStarted) {
231
     if(this.callStatsStarted) {
232
         var index = Statistics.callsStatsInstances.indexOf(this.callstats);
232
         var index = Statistics.callsStatsInstances.indexOf(this.callstats);
233
-        if(index > -1)            {
233
+        if(index > -1) {
234
             Statistics.callsStatsInstances.splice(index, 1);
234
             Statistics.callsStatsInstances.splice(index, 1);
235
         }
235
         }
236
         // The next line is commented because we need to be able to send
236
         // The next line is commented because we need to be able to send
257
  * @param {RTCPeerConnection} pc connection on which failure occured.
257
  * @param {RTCPeerConnection} pc connection on which failure occured.
258
  */
258
  */
259
 Statistics.prototype.sendIceConnectionFailedEvent = function (pc) {
259
 Statistics.prototype.sendIceConnectionFailedEvent = function (pc) {
260
-    if(this.callstats)        {
260
+    if(this.callstats) {
261
         this.callstats.sendIceConnectionFailedEvent(pc, this.callstats);
261
         this.callstats.sendIceConnectionFailedEvent(pc, this.callstats);
262
     }
262
     }
263
     Statistics.analytics.sendEvent('connection.ice_failed');
263
     Statistics.analytics.sendEvent('connection.ice_failed');
269
  * @param type {String} "audio"/"video"
269
  * @param type {String} "audio"/"video"
270
  */
270
  */
271
 Statistics.prototype.sendMuteEvent = function (muted, type) {
271
 Statistics.prototype.sendMuteEvent = function (muted, type) {
272
-    if(this.callstats)        {
272
+    if(this.callstats) {
273
         CallStats.sendMuteEvent(muted, type, this.callstats);
273
         CallStats.sendMuteEvent(muted, type, this.callstats);
274
     }
274
     }
275
 };
275
 };
280
  * false for not stopping
280
  * false for not stopping
281
  */
281
  */
282
 Statistics.prototype.sendScreenSharingEvent = function (start) {
282
 Statistics.prototype.sendScreenSharingEvent = function (start) {
283
-    if(this.callstats)        {
283
+    if(this.callstats) {
284
         CallStats.sendScreenSharingEvent(start, this.callstats);
284
         CallStats.sendScreenSharingEvent(start, this.callstats);
285
     }
285
     }
286
 };
286
 };
290
  * conference.
290
  * conference.
291
  */
291
  */
292
 Statistics.prototype.sendDominantSpeakerEvent = function () {
292
 Statistics.prototype.sendDominantSpeakerEvent = function () {
293
-    if(this.callstats)        {
293
+    if(this.callstats) {
294
         CallStats.sendDominantSpeakerEvent(this.callstats);
294
         CallStats.sendDominantSpeakerEvent(this.callstats);
295
     }
295
     }
296
 };
296
 };
360
  * @param {RTCPeerConnection} pc connection on which failure occured.
360
  * @param {RTCPeerConnection} pc connection on which failure occured.
361
  */
361
  */
362
 Statistics.prototype.sendCreateOfferFailed = function (e, pc) {
362
 Statistics.prototype.sendCreateOfferFailed = function (e, pc) {
363
-    if(this.callstats)        {
363
+    if(this.callstats) {
364
         CallStats.sendCreateOfferFailed(e, pc, this.callstats);
364
         CallStats.sendCreateOfferFailed(e, pc, this.callstats);
365
     }
365
     }
366
 };
366
 };
372
  * @param {RTCPeerConnection} pc connection on which failure occured.
372
  * @param {RTCPeerConnection} pc connection on which failure occured.
373
  */
373
  */
374
 Statistics.prototype.sendCreateAnswerFailed = function (e, pc) {
374
 Statistics.prototype.sendCreateAnswerFailed = function (e, pc) {
375
-    if(this.callstats)        {
375
+    if(this.callstats) {
376
         CallStats.sendCreateAnswerFailed(e, pc, this.callstats);
376
         CallStats.sendCreateAnswerFailed(e, pc, this.callstats);
377
     }
377
     }
378
 };
378
 };
384
  * @param {RTCPeerConnection} pc connection on which failure occured.
384
  * @param {RTCPeerConnection} pc connection on which failure occured.
385
  */
385
  */
386
 Statistics.prototype.sendSetLocalDescFailed = function (e, pc) {
386
 Statistics.prototype.sendSetLocalDescFailed = function (e, pc) {
387
-    if(this.callstats)        {
387
+    if(this.callstats) {
388
         CallStats.sendSetLocalDescFailed(e, pc, this.callstats);
388
         CallStats.sendSetLocalDescFailed(e, pc, this.callstats);
389
     }
389
     }
390
 };
390
 };
396
  * @param {RTCPeerConnection} pc connection on which failure occured.
396
  * @param {RTCPeerConnection} pc connection on which failure occured.
397
  */
397
  */
398
 Statistics.prototype.sendSetRemoteDescFailed = function (e, pc) {
398
 Statistics.prototype.sendSetRemoteDescFailed = function (e, pc) {
399
-    if(this.callstats)        {
399
+    if(this.callstats) {
400
         CallStats.sendSetRemoteDescFailed(e, pc, this.callstats);
400
         CallStats.sendSetRemoteDescFailed(e, pc, this.callstats);
401
     }
401
     }
402
 };
402
 };
408
  * @param {RTCPeerConnection} pc connection on which failure occured.
408
  * @param {RTCPeerConnection} pc connection on which failure occured.
409
  */
409
  */
410
 Statistics.prototype.sendAddIceCandidateFailed = function (e, pc) {
410
 Statistics.prototype.sendAddIceCandidateFailed = function (e, pc) {
411
-    if(this.callstats)        {
411
+    if(this.callstats) {
412
         CallStats.sendAddIceCandidateFailed(e, pc, this.callstats);
412
         CallStats.sendAddIceCandidateFailed(e, pc, this.callstats);
413
     }
413
     }
414
 };
414
 };
435
  * @param detailed detailed feedback from the user. Not yet used
435
  * @param detailed detailed feedback from the user. Not yet used
436
  */
436
  */
437
 Statistics.prototype.sendFeedback = function(overall, detailed) {
437
 Statistics.prototype.sendFeedback = function(overall, detailed) {
438
-    if(this.callstats)        {
438
+    if(this.callstats) {
439
         this.callstats.sendFeedback(overall, detailed);
439
         this.callstats.sendFeedback(overall, detailed);
440
     }
440
     }
441
     Statistics.analytics.sendEvent("feedback.rating",
441
     Statistics.analytics.sendEvent("feedback.rating",

+ 7
- 7
modules/transcription/audioRecorder.js View File

6
  * Possible audio formats MIME types
6
  * Possible audio formats MIME types
7
  */
7
  */
8
 var AUDIO_WEBM = "audio/webm";    // Supported in chrome
8
 var AUDIO_WEBM = "audio/webm";    // Supported in chrome
9
-var AUDIO_OGG  = "audio/ogg";     // Supported in firefox
9
+var AUDIO_OGG = "audio/ogg";     // Supported in firefox
10
 
10
 
11
 /**
11
 /**
12
  * A TrackRecorder object holds all the information needed for recording a
12
  * A TrackRecorder object holds all the information needed for recording a
91
 function determineCorrectFileType() {
91
 function determineCorrectFileType() {
92
     if(MediaRecorder.isTypeSupported(AUDIO_WEBM)) {
92
     if(MediaRecorder.isTypeSupported(AUDIO_WEBM)) {
93
         return AUDIO_WEBM;
93
         return AUDIO_WEBM;
94
-    }    else if(MediaRecorder.isTypeSupported(AUDIO_OGG)) {
94
+    } else if(MediaRecorder.isTypeSupported(AUDIO_OGG)) {
95
         return AUDIO_OGG;
95
         return AUDIO_OGG;
96
-    }    else {
96
+    } else {
97
         throw new Error("unable to create a MediaRecorder with the" +
97
         throw new Error("unable to create a MediaRecorder with the" +
98
             "right mimetype!");
98
             "right mimetype!");
99
     }
99
     }
167
             var recorderToRemove = array[i];
167
             var recorderToRemove = array[i];
168
             if(this.isRecording){
168
             if(this.isRecording){
169
                 stopRecorder(recorderToRemove);
169
                 stopRecorder(recorderToRemove);
170
-            }            else {
170
+            } else {
171
                 //remove the TrackRecorder from the array
171
                 //remove the TrackRecorder from the array
172
                 array.splice(i, 1);
172
                 array.splice(i, 1);
173
             }
173
             }
188
     this.recorders.forEach(function(trackRecorder){
188
     this.recorders.forEach(function(trackRecorder){
189
         if(trackRecorder.track.isLocal()){
189
         if(trackRecorder.track.isLocal()){
190
             trackRecorder.name = "the transcriber";
190
             trackRecorder.name = "the transcriber";
191
-        }        else {
191
+        } else {
192
             var id = trackRecorder.track.getParticipantId();
192
             var id = trackRecorder.track.getParticipantId();
193
             var participant = conference.getParticipantById(id);
193
             var participant = conference.getParticipantById(id);
194
             var newName = participant.getDisplayName();
194
             var newName = participant.getDisplayName();
292
     // Firefox supports the MediaStream object, Chrome webkitMediaStream
292
     // Firefox supports the MediaStream object, Chrome webkitMediaStream
293
     if(typeof MediaStream !== 'undefined') {
293
     if(typeof MediaStream !== 'undefined') {
294
         return new MediaStream();
294
         return new MediaStream();
295
-    }    else if(typeof webkitMediaStream !== 'undefined') {
295
+    } else if(typeof webkitMediaStream !== 'undefined') {
296
         return new webkitMediaStream(); // eslint-disable-line new-cap
296
         return new webkitMediaStream(); // eslint-disable-line new-cap
297
-    }    else {
297
+    } else {
298
         throw new Error("cannot create a clean mediaStream");
298
         throw new Error("cannot create a clean mediaStream");
299
     }
299
     }
300
 }
300
 }

+ 3
- 3
modules/transcription/transcriber.js View File

21
     //the object which can record all audio in the conference
21
     //the object which can record all audio in the conference
22
     this.audioRecorder = new AudioRecorder();
22
     this.audioRecorder = new AudioRecorder();
23
     //this object can send the recorder audio to a speech-to-text service
23
     //this object can send the recorder audio to a speech-to-text service
24
-    this.transcriptionService =  new SphinxService();
24
+    this.transcriptionService = new SphinxService();
25
     //holds a counter to keep track if merging can start
25
     //holds a counter to keep track if merging can start
26
     this.counter = null;
26
     this.counter = null;
27
     //holds the date when transcription started which makes it possible
27
     //holds the date when transcription started which makes it possible
31
     this.transcription = null;
31
     this.transcription = null;
32
     //this will be a method which will be called once the transcription is done
32
     //this will be a method which will be called once the transcription is done
33
     //with the transcription as parameter
33
     //with the transcription as parameter
34
-    this.callback =  null;
34
+    this.callback = null;
35
     //stores all the retrieved speech-to-text results to merge together
35
     //stores all the retrieved speech-to-text results to merge together
36
     //this value will store an Array<Word> object
36
     //this value will store an Array<Word> object
37
     this.results = [];
37
     this.results = [];
255
 var pushWordToSortedArray = function(array, word){
255
 var pushWordToSortedArray = function(array, word){
256
     if(array.length === 0) {
256
     if(array.length === 0) {
257
         array.push(word);
257
         array.push(word);
258
-    }    else{
258
+    } else{
259
         if(array[array.length - 1].begin <= word.begin){
259
         if(array[array.length - 1].begin <= word.begin){
260
             array.push(word);
260
             array.push(word);
261
             return;
261
             return;

+ 1
- 1
modules/transcription/transcriptionServices/AbstractTranscriptionService.js View File

24
                    " is not valid!");
24
                    " is not valid!");
25
             recordingResult.wordArray = [];
25
             recordingResult.wordArray = [];
26
             callback(recordingResult);
26
             callback(recordingResult);
27
-        }        else{
27
+        } else{
28
             recordingResult.wordArray = t.formatResponse(response);
28
             recordingResult.wordArray = t.formatResponse(response);
29
             callback(recordingResult);
29
             callback(recordingResult);
30
         }
30
         }

+ 3
- 3
modules/transcription/transcriptionServices/SphinxTranscriptionService.js View File

85
     var json;
85
     var json;
86
     try{
86
     try{
87
         json = JSON.parse(response);
87
         json = JSON.parse(response);
88
-    }    catch (error){
88
+    } catch (error){
89
         console.log(error);
89
         console.log(error);
90
         return false;
90
         return false;
91
     }
91
     }
113
     "Sphinx4 https server";
113
     "Sphinx4 https server";
114
     if(config.sphinxURL === undefined){
114
     if(config.sphinxURL === undefined){
115
         console.log(message);
115
         console.log(message);
116
-    }    else {
116
+    } else {
117
         var toReturn = config.sphinxURL;
117
         var toReturn = config.sphinxURL;
118
         if(toReturn.includes !== undefined && toReturn.includes("https://")){
118
         if(toReturn.includes !== undefined && toReturn.includes("https://")){
119
             return toReturn;
119
             return toReturn;
120
-        }        else{
120
+        } else{
121
             console.log(message);
121
             console.log(message);
122
         }
122
         }
123
     }
123
     }

+ 1
- 1
modules/util/EventEmitterForwarder.js View File

7
  */
7
  */
8
 function EventEmitterForwarder (src, dest) {
8
 function EventEmitterForwarder (src, dest) {
9
     if (!src || !dest || typeof src.addListener !== "function" ||
9
     if (!src || !dest || typeof src.addListener !== "function" ||
10
-        typeof dest.emit !== "function")        {
10
+        typeof dest.emit !== "function") {
11
         throw new Error("Invalid arguments passed to EventEmitterForwarder");
11
         throw new Error("Invalid arguments passed to EventEmitterForwarder");
12
     }
12
     }
13
     this.src = src;
13
     this.src = src;

+ 4
- 4
modules/util/GlobalOnErrorHandler.js View File

22
     handlers.forEach(function (handler) {
22
     handlers.forEach(function (handler) {
23
         handler(message, source, lineno, colno, error);
23
         handler(message, source, lineno, colno, error);
24
     });
24
     });
25
-    if (oldOnErrorHandler)        {
25
+    if (oldOnErrorHandler) {
26
         oldOnErrorHandler(message, source, lineno, colno, error);
26
         oldOnErrorHandler(message, source, lineno, colno, error);
27
     }
27
     }
28
 }
28
 }
38
     handlers.forEach(function (handler) {
38
     handlers.forEach(function (handler) {
39
         handler(null, null, null, null, event.reason);
39
         handler(null, null, null, null, event.reason);
40
     });
40
     });
41
-    if(oldOnUnhandledRejection)        {
41
+    if(oldOnUnhandledRejection) {
42
         oldOnUnhandledRejection(event);
42
         oldOnUnhandledRejection(event);
43
     }
43
     }
44
 }
44
 }
62
      */
62
      */
63
     callErrorHandler: function (error) {
63
     callErrorHandler: function (error) {
64
         var errHandler = window.onerror;
64
         var errHandler = window.onerror;
65
-        if(!errHandler)            {
65
+        if(!errHandler) {
66
             return;
66
             return;
67
         }
67
         }
68
         errHandler(null, null, null, null, error);
68
         errHandler(null, null, null, null, error);
73
      */
73
      */
74
     callUnhandledRejectionHandler: function (error) {
74
     callUnhandledRejectionHandler: function (error) {
75
         var errHandler = window.onunhandledrejection;
75
         var errHandler = window.onunhandledrejection;
76
-        if(!errHandler)            {
76
+        if(!errHandler) {
77
             return;
77
             return;
78
         }
78
         }
79
         errHandler(error);
79
         errHandler(error);

+ 3
- 3
modules/util/ScriptUtil.js View File

38
                 var scriptSrc = scriptEl.src;
38
                 var scriptSrc = scriptEl.src;
39
                 var baseScriptSrc
39
                 var baseScriptSrc
40
                     = scriptSrc.substring(0, scriptSrc.lastIndexOf('/') + 1);
40
                     = scriptSrc.substring(0, scriptSrc.lastIndexOf('/') + 1);
41
-                if (scriptSrc && baseScriptSrc)                    {
41
+                if (scriptSrc && baseScriptSrc) {
42
                     src = baseScriptSrc + src;
42
                     src = baseScriptSrc + src;
43
                 }
43
                 }
44
             }
44
             }
45
         }
45
         }
46
 
46
 
47
-        if (loadCallback)            {
47
+        if (loadCallback) {
48
             script.onload = loadCallback;
48
             script.onload = loadCallback;
49
         }
49
         }
50
-        if (errorCallback)            {
50
+        if (errorCallback) {
51
             script.onerror = errorCallback;
51
             script.onerror = errorCallback;
52
         }
52
         }
53
 
53
 

+ 1
- 1
modules/util/UsernameGenerator.js View File

433
     var name = RandomUtil.randomElement(names);
433
     var name = RandomUtil.randomElement(names);
434
     var suffix = RandomUtil.randomAlphanumStr(3);
434
     var suffix = RandomUtil.randomAlphanumStr(3);
435
 
435
 
436
-    return name + '-' +  suffix;
436
+    return name + '-' + suffix;
437
 }
437
 }
438
 
438
 
439
 module.exports = {
439
 module.exports = {

+ 1
- 1
modules/version/ComponentsVersions.js View File

74
         }.bind(this));
74
         }.bind(this));
75
 
75
 
76
     // logs versions to stats
76
     // logs versions to stats
77
-        if (log.length > 0)        {
77
+        if (log.length > 0) {
78
             Statistics.sendLog(JSON.stringify(log));
78
             Statistics.sendLog(JSON.stringify(log));
79
         }
79
         }
80
     };
80
     };

+ 1
- 1
modules/xmpp/Caps.js View File

104
     getFeatures(jid, timeout = 5000) {
104
     getFeatures(jid, timeout = 5000) {
105
         const user
105
         const user
106
             = jid in this.jidToVersion ? this.jidToVersion[jid] : null;
106
             = jid in this.jidToVersion ? this.jidToVersion[jid] : null;
107
-        if(!user || !(user.version in this.versionToCapabilities))        {
107
+        if(!user || !(user.version in this.versionToCapabilities)) {
108
             const node = user? user.node + "#" + user.version : null;
108
             const node = user? user.node + "#" + user.version : null;
109
             return new Promise ( (resolve, reject) =>
109
             return new Promise ( (resolve, reject) =>
110
                 this.disco.info(jid, node, response => {
110
                 this.disco.info(jid, node, response => {

+ 23
- 23
modules/xmpp/ChatRoom.js View File

37
                 continue;
37
                 continue;
38
             }
38
             }
39
             packet.c(node.tagName, node.attributes);
39
             packet.c(node.tagName, node.attributes);
40
-            if(node.value)                {
40
+            if(node.value) {
41
                 packet.t(node.value);
41
                 packet.t(node.value);
42
             }
42
             }
43
-            if(node.children)                {
43
+            if(node.children) {
44
                 this.json2packet(node.children, packet);
44
                 this.json2packet(node.children, packet);
45
             }
45
             }
46
             packet.up();
46
             packet.up();
56
  */
56
  */
57
 function filterNodeFromPresenceJSON(pres, nodeName){
57
 function filterNodeFromPresenceJSON(pres, nodeName){
58
     var res = [];
58
     var res = [];
59
-    for(let i = 0; i < pres.length; i++)        {
60
-        if(pres[i].tagName === nodeName)            {
59
+    for(let i = 0; i < pres.length; i++) {
60
+        if(pres[i].tagName === nodeName) {
61
             res.push(pres[i]);
61
             res.push(pres[i]);
62
         }
62
         }
63
     }
63
     }
279
         let jibri = null;
279
         let jibri = null;
280
         // process nodes to extract data needed for MUC_JOINED and MUC_MEMBER_JOINED
280
         // process nodes to extract data needed for MUC_JOINED and MUC_MEMBER_JOINED
281
         // events
281
         // events
282
-        for(let i = 0; i < nodes.length; i++)        {
282
+        for(let i = 0; i < nodes.length; i++) {
283
             const node = nodes[i];
283
             const node = nodes[i];
284
-            switch(node.tagName)            {
284
+            switch(node.tagName) {
285
             case "nick":
285
             case "nick":
286
                 member.nick = node.value;
286
                 member.nick = node.value;
287
                 break;
287
                 break;
304
                 logger.log("(TIME) MUC joined:\t", now);
304
                 logger.log("(TIME) MUC joined:\t", now);
305
 
305
 
306
                 // set correct initial state of locked
306
                 // set correct initial state of locked
307
-                if (this.password)                    {
307
+                if (this.password) {
308
                     this.locked = true;
308
                     this.locked = true;
309
                 }
309
                 }
310
 
310
 
345
             }
345
             }
346
 
346
 
347
             // store the new display name
347
             // store the new display name
348
-            if(member.displayName)                {
348
+            if(member.displayName) {
349
                 memberOfThis.displayName = member.displayName;
349
                 memberOfThis.displayName = member.displayName;
350
             }
350
             }
351
         }
351
         }
352
 
352
 
353
         // after we had fired member or room joined events, lets fire events
353
         // after we had fired member or room joined events, lets fire events
354
         // for the rest info we got in presence
354
         // for the rest info we got in presence
355
-        for(let i = 0; i < nodes.length; i++)        {
355
+        for(let i = 0; i < nodes.length; i++) {
356
             const node = nodes[i];
356
             const node = nodes[i];
357
-            switch(node.tagName)            {
357
+            switch(node.tagName) {
358
             case "nick":
358
             case "nick":
359
                 if(!member.isFocus) {
359
                 if(!member.isFocus) {
360
                     var displayName = this.xmpp.options.displayJids
360
                     var displayName = this.xmpp.options.displayJids
377
                 break;
377
                 break;
378
             case "call-control":
378
             case "call-control":
379
                 var att = node.attributes;
379
                 var att = node.attributes;
380
-                if(!att)                        {
380
+                if(!att) {
381
                     break;
381
                     break;
382
                 }
382
                 }
383
                 this.phoneNumber = att.phone || null;
383
                 this.phoneNumber = att.phone || null;
394
             this.eventEmitter.emit(XMPPEvents.PRESENCE_STATUS, from, member.status);
394
             this.eventEmitter.emit(XMPPEvents.PRESENCE_STATUS, from, member.status);
395
         }
395
         }
396
 
396
 
397
-        if(jibri)        {
397
+        if(jibri) {
398
             this.lastJibri = jibri;
398
             this.lastJibri = jibri;
399
-            if(this.recording)                {
399
+            if(this.recording) {
400
                 this.recording.handleJibriPresence(jibri);
400
                 this.recording.handleJibriPresence(jibri);
401
             }
401
             }
402
         }
402
         }
413
             this.recording = new Recorder(this.options.recordingType,
413
             this.recording = new Recorder(this.options.recordingType,
414
                 this.eventEmitter, this.connection, this.focusMucJid,
414
                 this.eventEmitter, this.connection, this.focusMucJid,
415
                 this.options.jirecon, this.roomjid);
415
                 this.options.jirecon, this.roomjid);
416
-            if(this.lastJibri)                {
416
+            if(this.lastJibri) {
417
                 this.recording.handleJibriPresence(this.lastJibri);
417
                 this.recording.handleJibriPresence(this.lastJibri);
418
             }
418
             }
419
         }
419
         }
472
 
472
 
473
         delete this.lastPresences[jid];
473
         delete this.lastPresences[jid];
474
 
474
 
475
-        if(skipEvents)            {
475
+        if(skipEvents) {
476
             return;
476
             return;
477
         }
477
         }
478
 
478
 
524
 
524
 
525
             // we fire muc_left only if this is not a kick,
525
             // we fire muc_left only if this is not a kick,
526
             // kick has both statuses 110 and 307.
526
             // kick has both statuses 110 and 307.
527
-            if (!isKick)                {
527
+            if (!isKick) {
528
                 this.eventEmitter.emit(XMPPEvents.MUC_LEFT);
528
                 this.eventEmitter.emit(XMPPEvents.MUC_LEFT);
529
             }
529
             }
530
         }
530
         }
700
 
700
 
701
     setVideoMute (mute, callback) {
701
     setVideoMute (mute, callback) {
702
         this.sendVideoInfoPresence(mute);
702
         this.sendVideoInfoPresence(mute);
703
-        if(callback)            {
703
+        if(callback) {
704
             callback(mute);
704
             callback(mute);
705
         }
705
         }
706
     }
706
     }
717
                 value: mute.toString()});
717
                 value: mute.toString()});
718
     }
718
     }
719
 
719
 
720
-    sendAudioInfoPresence  (mute, callback) {
720
+    sendAudioInfoPresence (mute, callback) {
721
         this.addAudioInfoToPresence(mute);
721
         this.addAudioInfoToPresence(mute);
722
         if(this.connection) {
722
         if(this.connection) {
723
             this.sendPresence();
723
             this.sendPresence();
724
         }
724
         }
725
-        if(callback)            {
725
+        if(callback) {
726
             callback();
726
             callback();
727
         }
727
         }
728
     }
728
     }
737
 
737
 
738
     sendVideoInfoPresence (mute) {
738
     sendVideoInfoPresence (mute) {
739
         this.addVideoInfoToPresence(mute);
739
         this.addVideoInfoToPresence(mute);
740
-        if(!this.connection)            {
740
+        if(!this.connection) {
741
             return;
741
             return;
742
         }
742
         }
743
         this.sendPresence();
743
         this.sendPresence();
790
      * Returns true if the recording is supproted and false if not.
790
      * Returns true if the recording is supproted and false if not.
791
      */
791
      */
792
     isRecordingSupported () {
792
     isRecordingSupported () {
793
-        if(this.recording)            {
793
+        if(this.recording) {
794
             return this.recording.isSupported();
794
             return this.recording.isSupported();
795
         }
795
         }
796
         return false;
796
         return false;
817
      * @param statusChangeHandler {function} receives the new status as argument.
817
      * @param statusChangeHandler {function} receives the new status as argument.
818
      */
818
      */
819
     toggleRecording (options, statusChangeHandler) {
819
     toggleRecording (options, statusChangeHandler) {
820
-        if(this.recording)            {
820
+        if(this.recording) {
821
             return this.recording.toggleRecording(options, statusChangeHandler);
821
             return this.recording.toggleRecording(options, statusChangeHandler);
822
         }
822
         }
823
 
823
 
829
      * Returns true if the SIP calls are supported and false otherwise
829
      * Returns true if the SIP calls are supported and false otherwise
830
      */
830
      */
831
     isSIPCallingSupported () {
831
     isSIPCallingSupported () {
832
-        if(this.moderator)            {
832
+        if(this.moderator) {
833
             return this.moderator.isSipGatewayEnabled();
833
             return this.moderator.isSipGatewayEnabled();
834
         }
834
         }
835
         return false;
835
         return false;

+ 11
- 11
modules/xmpp/JingleSessionPC.js View File

130
                 if (typeof protocol === 'string') {
130
                 if (typeof protocol === 'string') {
131
                     protocol = protocol.toLowerCase();
131
                     protocol = protocol.toLowerCase();
132
                     if (protocol === 'tcp' || protocol === 'ssltcp') {
132
                     if (protocol === 'tcp' || protocol === 'ssltcp') {
133
-                        if (this.webrtcIceTcpDisable)                            {
133
+                        if (this.webrtcIceTcpDisable) {
134
                             return;
134
                             return;
135
                         }
135
                         }
136
                     } else if (protocol == 'udp') {
136
                     } else if (protocol == 'udp') {
137
-                        if (this.webrtcIceUdpDisable)                            {
137
+                        if (this.webrtcIceUdpDisable) {
138
                             return;
138
                             return;
139
                         }
139
                         }
140
                     }
140
                     }
195
 
195
 
196
                 break;
196
                 break;
197
             case 'disconnected':
197
             case 'disconnected':
198
-                if (this.closed)                        {
198
+                if (this.closed) {
199
                     break;
199
                     break;
200
                 }
200
                 }
201
                 this.isreconnect = true;
201
                 this.isreconnect = true;
202
                     // Informs interested parties that the connection has been
202
                     // Informs interested parties that the connection has been
203
                     // interrupted.
203
                     // interrupted.
204
-                if (this.wasstable)                        {
204
+                if (this.wasstable) {
205
                     this.room.eventEmitter.emit(
205
                     this.room.eventEmitter.emit(
206
                             XMPPEvents.CONNECTION_INTERRUPTED);
206
                             XMPPEvents.CONNECTION_INTERRUPTED);
207
                 }
207
                 }
668
                 }
668
                 }
669
                 $(this).find('>parameter').each(function () {
669
                 $(this).find('>parameter').each(function () {
670
                     lines += 'a=ssrc:' + ssrc + ' ' + $(this).attr('name');
670
                     lines += 'a=ssrc:' + ssrc + ' ' + $(this).attr('name');
671
-                    if ($(this).attr('value') && $(this).attr('value').length)                        {
671
+                    if ($(this).attr('value') && $(this).attr('value').length) {
672
                         lines += ':' + $(this).attr('value');
672
                         lines += ':' + $(this).attr('value');
673
                     }
673
                     }
674
                     lines += '\r\n';
674
                     lines += '\r\n';
675
                 });
675
                 });
676
             });
676
             });
677
             currentRemoteSdp.media.forEach(function(media, idx) {
677
             currentRemoteSdp.media.forEach(function(media, idx) {
678
-                if (!SDPUtil.find_line(media, 'a=mid:' + name))                    {
678
+                if (!SDPUtil.find_line(media, 'a=mid:' + name)) {
679
                     return;
679
                     return;
680
                 }
680
                 }
681
                 if (!addSsrcInfo[idx]) {
681
                 if (!addSsrcInfo[idx]) {
1040
                 ssrcs.push(ssrc);
1040
                 ssrcs.push(ssrc);
1041
             });
1041
             });
1042
             currentRemoteSdp.media.forEach(function(media, idx) {
1042
             currentRemoteSdp.media.forEach(function(media, idx) {
1043
-                if (!SDPUtil.find_line(media, 'a=mid:' + name))                    {
1043
+                if (!SDPUtil.find_line(media, 'a=mid:' + name)) {
1044
                     return;
1044
                     return;
1045
                 }
1045
                 }
1046
                 if (!removeSsrcInfo[idx]) {
1046
                 if (!removeSsrcInfo[idx]) {
1336
             if (errorElSel.length) {
1336
             if (errorElSel.length) {
1337
                 error.code = errorElSel.attr('code');
1337
                 error.code = errorElSel.attr('code');
1338
                 const errorReasonSel = $(errResponse).find('error :first');
1338
                 const errorReasonSel = $(errResponse).find('error :first');
1339
-                if (errorReasonSel.length)                    {
1339
+                if (errorReasonSel.length) {
1340
                     error.reason = errorReasonSel[0].tagName;
1340
                     error.reason = errorReasonSel[0].tagName;
1341
                 }
1341
                 }
1342
             }
1342
             }
1450
             ssrcs.forEach(function (ssrcObj) {
1450
             ssrcs.forEach(function (ssrcObj) {
1451
                 const desc = $(jingle.tree()).find(">jingle>content[name=\"" +
1451
                 const desc = $(jingle.tree()).find(">jingle>content[name=\"" +
1452
                     ssrcObj.mtype + "\"]>description");
1452
                     ssrcObj.mtype + "\"]>description");
1453
-                if (!desc || !desc.length)                    {
1453
+                if (!desc || !desc.length) {
1454
                     return;
1454
                     return;
1455
                 }
1455
                 }
1456
                 ssrcObj.ssrcs.forEach(function (ssrc) {
1456
                 ssrcObj.ssrcs.forEach(function (ssrc) {
1516
     fixSourceRemoveJingle(jingle) {
1516
     fixSourceRemoveJingle(jingle) {
1517
         let ssrcs = this.modifiedSSRCs["mute"];
1517
         let ssrcs = this.modifiedSSRCs["mute"];
1518
         this.modifiedSSRCs["mute"] = [];
1518
         this.modifiedSSRCs["mute"] = [];
1519
-        if (ssrcs && ssrcs.length)            {
1519
+        if (ssrcs && ssrcs.length) {
1520
             ssrcs.forEach(function (ssrcObj) {
1520
             ssrcs.forEach(function (ssrcObj) {
1521
                 ssrcObj.ssrcs.forEach(function (ssrc) {
1521
                 ssrcObj.ssrcs.forEach(function (ssrc) {
1522
                     const sourceNode
1522
                     const sourceNode
1539
 
1539
 
1540
         ssrcs = this.modifiedSSRCs["remove"];
1540
         ssrcs = this.modifiedSSRCs["remove"];
1541
         this.modifiedSSRCs["remove"] = [];
1541
         this.modifiedSSRCs["remove"] = [];
1542
-        if (ssrcs && ssrcs.length)            {
1542
+        if (ssrcs && ssrcs.length) {
1543
             ssrcs.forEach(function (ssrcObj) {
1543
             ssrcs.forEach(function (ssrcObj) {
1544
                 const desc
1544
                 const desc
1545
                     = JingleSessionPC.createDescriptionNode(
1545
                     = JingleSessionPC.createDescriptionNode(

+ 1
- 1
modules/xmpp/RtxModifier.js View File

1
 /* global __filename */
1
 /* global __filename */
2
 
2
 
3
 import { getLogger } from "jitsi-meet-logger";
3
 import { getLogger } from "jitsi-meet-logger";
4
-import { parseSecondarySSRC, SdpTransformWrap  } from './SdpTransformUtil';
4
+import { parseSecondarySSRC, SdpTransformWrap } from './SdpTransformUtil';
5
 import * as SDPUtil from "./SDPUtil";
5
 import * as SDPUtil from "./SDPUtil";
6
 
6
 
7
 const logger = getLogger(__filename);
7
 const logger = getLogger(__filename);

+ 9
- 9
modules/xmpp/SDP.js View File

92
     var medias = this.getMediaSsrcMap();
92
     var medias = this.getMediaSsrcMap();
93
     var result = false;
93
     var result = false;
94
     Object.keys(medias).forEach(function (mediaindex) {
94
     Object.keys(medias).forEach(function (mediaindex) {
95
-        if (result)            {
95
+        if (result) {
96
             return;
96
             return;
97
         }
97
         }
98
         if (medias[mediaindex].ssrcs[ssrc]) {
98
         if (medias[mediaindex].ssrcs[ssrc]) {
109
         lines = this.media[i].split('\r\n');
109
         lines = this.media[i].split('\r\n');
110
         lines.pop(); // remove empty last element
110
         lines.pop(); // remove empty last element
111
         mline = SDPUtil.parse_mline(lines.shift());
111
         mline = SDPUtil.parse_mline(lines.shift());
112
-        if (mline.media != 'audio')            {
112
+        if (mline.media != 'audio') {
113
             continue;
113
             continue;
114
         }
114
         }
115
         newdesc = '';
115
         newdesc = '';
117
         for (j = 0; j < lines.length; j++) {
117
         for (j = 0; j < lines.length; j++) {
118
             if (lines[j].substr(0, 9) == 'a=rtpmap:') {
118
             if (lines[j].substr(0, 9) == 'a=rtpmap:') {
119
                 rtpmap = SDPUtil.parse_rtpmap(lines[j]);
119
                 rtpmap = SDPUtil.parse_rtpmap(lines[j]);
120
-                if (rtpmap.name == 'CN' || rtpmap.name == 'ISAC')                    {
120
+                if (rtpmap.name == 'CN' || rtpmap.name == 'ISAC') {
121
                     continue;
121
                     continue;
122
                 }
122
                 }
123
                 mline.fmt.push(rtpmap.id);
123
                 mline.fmt.push(rtpmap.id);
371
             protocol: sctpAttrs[1] /* protocol */
371
             protocol: sctpAttrs[1] /* protocol */
372
         });
372
         });
373
         // Optional stream count attribute
373
         // Optional stream count attribute
374
-        if (sctpAttrs.length > 2)            {
374
+        if (sctpAttrs.length > 2) {
375
             elem.attrs({ streams: sctpAttrs[2]});
375
             elem.attrs({ streams: sctpAttrs[2]});
376
         }
376
         }
377
         elem.up();
377
         elem.up();
526
             ' ' + sctp.attr('protocol');
526
             ' ' + sctp.attr('protocol');
527
 
527
 
528
         var streamCount = sctp.attr('streams');
528
         var streamCount = sctp.attr('streams');
529
-        if (streamCount)            {
529
+        if (streamCount) {
530
             media += ' ' + streamCount + '\r\n';
530
             media += ' ' + streamCount + '\r\n';
531
-        }        else            {
531
+        } else {
532
             media += '\r\n';
532
             media += '\r\n';
533
         }
533
         }
534
     }
534
     }
535
 
535
 
536
     media += 'c=IN IP4 0.0.0.0\r\n';
536
     media += 'c=IN IP4 0.0.0.0\r\n';
537
-    if (!sctp.length)        {
537
+    if (!sctp.length) {
538
         media += 'a=rtcp:1 IN IP4 0.0.0.0\r\n';
538
         media += 'a=rtcp:1 IN IP4 0.0.0.0\r\n';
539
     }
539
     }
540
     tmp = content.find('>transport[xmlns="urn:xmpp:jingle:transports:ice-udp:1"]');
540
     tmp = content.find('>transport[xmlns="urn:xmpp:jingle:transports:ice-udp:1"]');
621
                 && (protocol === 'tcp' || protocol === 'ssltcp')) ||
621
                 && (protocol === 'tcp' || protocol === 'ssltcp')) ||
622
             (self.removeUdpCandidates && protocol === 'udp')) {
622
             (self.removeUdpCandidates && protocol === 'udp')) {
623
             return;
623
             return;
624
-        } else  if (self.failICE) {
624
+        } else if (self.failICE) {
625
             this.setAttribute('ip', '1.1.1.1');
625
             this.setAttribute('ip', '1.1.1.1');
626
         }
626
         }
627
 
627
 
648
             var value = this.getAttribute('value');
648
             var value = this.getAttribute('value');
649
             value = SDPUtil.filter_special_chars(value);
649
             value = SDPUtil.filter_special_chars(value);
650
             media += 'a=ssrc:' + ssrc + ' ' + name;
650
             media += 'a=ssrc:' + ssrc + ' ' + name;
651
-            if (value && value.length)                {
651
+            if (value && value.length) {
652
                 media += ':' + value;
652
                 media += ':' + value;
653
             }
653
             }
654
             media += '\r\n';
654
             media += '\r\n';

+ 4
- 4
modules/xmpp/SDPDiffer.js View File

14
     // this could be useful in Array.prototype.
14
     // this could be useful in Array.prototype.
15
     function arrayEquals(array) {
15
     function arrayEquals(array) {
16
         // if the other array is a falsy value, return
16
         // if the other array is a falsy value, return
17
-        if (!array)            {
17
+        if (!array) {
18
             return false;
18
             return false;
19
         }
19
         }
20
 
20
 
21
         // compare lengths - can save a lot of time
21
         // compare lengths - can save a lot of time
22
-        if (this.length != array.length)            {
22
+        if (this.length != array.length) {
23
             return false;
23
             return false;
24
         }
24
         }
25
 
25
 
27
             // Check if we have nested arrays
27
             // Check if we have nested arrays
28
             if (this[i] instanceof Array && array[i] instanceof Array) {
28
             if (this[i] instanceof Array && array[i] instanceof Array) {
29
                 // recurse into the nested arrays
29
                 // recurse into the nested arrays
30
-                if (!this[i].equals(array[i]))                    {
30
+                if (!this[i].equals(array[i])) {
31
                     return false;
31
                     return false;
32
                 }
32
                 }
33
-            }            else if (this[i] != array[i]) {
33
+            } else if (this[i] != array[i]) {
34
                 // Warning - two different object instances will never be
34
                 // Warning - two different object instances will never be
35
                 // equal: {x:20} != {x:20}
35
                 // equal: {x:20} != {x:20}
36
                 return false;
36
                 return false;

+ 2
- 2
modules/xmpp/SDPUtil.js View File

66
      * @param line eg. "a=sctpmap:5000 webrtc-datachannel"
66
      * @param line eg. "a=sctpmap:5000 webrtc-datachannel"
67
      * @returns [SCTP port number, protocol, streams]
67
      * @returns [SCTP port number, protocol, streams]
68
      */
68
      */
69
-    parse_sctpmap: function (line)    {
69
+    parse_sctpmap: function (line) {
70
         var parts = line.substring(10).split(' ');
70
         var parts = line.substring(10).split(' ');
71
         var sctpPort = parts[0];
71
         var sctpPort = parts[0];
72
         var protocol = parts[1];
72
         var protocol = parts[1];
244
         var lines = haystack.split('\r\n'),
244
         var lines = haystack.split('\r\n'),
245
             needles = [];
245
             needles = [];
246
         for (var i = 0; i < lines.length; i++) {
246
         for (var i = 0; i < lines.length; i++) {
247
-            if (lines[i].substring(0, needle.length) == needle)                {
247
+            if (lines[i].substring(0, needle.length) == needle) {
248
                 needles.push(lines[i]);
248
                 needles.push(lines[i]);
249
             }
249
             }
250
         }
250
         }

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

62
     }
62
     }
63
 }
63
 }
64
 
64
 
65
-Moderator.prototype.isExternalAuthEnabled =  function () {
65
+Moderator.prototype.isExternalAuthEnabled = function () {
66
     return this.externalAuthEnabled;
66
     return this.externalAuthEnabled;
67
 };
67
 };
68
 
68
 
69
-Moderator.prototype.isSipGatewayEnabled =  function () {
69
+Moderator.prototype.isSipGatewayEnabled = function () {
70
     return this.sipGatewayEnabled;
70
     return this.sipGatewayEnabled;
71
 };
71
 };
72
 
72
 
73
 
73
 
74
-Moderator.prototype.onMucMemberLeft =  function (jid) {
74
+Moderator.prototype.onMucMemberLeft = function (jid) {
75
     logger.info("Someone left is it focus ? " + jid);
75
     logger.info("Someone left is it focus ? " + jid);
76
     var resource = Strophe.getResourceFromJid(jid);
76
     var resource = Strophe.getResourceFromJid(jid);
77
     if (resource === 'focus') {
77
     if (resource === 'focus') {
82
 };
82
 };
83
 
83
 
84
 
84
 
85
-Moderator.prototype.setFocusUserJid =  function (focusJid) {
85
+Moderator.prototype.setFocusUserJid = function (focusJid) {
86
     if (!this.focusUserJid) {
86
     if (!this.focusUserJid) {
87
         this.focusUserJid = focusJid;
87
         this.focusUserJid = focusJid;
88
         logger.info("Focus jid set to:  " + this.focusUserJid);
88
         logger.info("Focus jid set to:  " + this.focusUserJid);
90
 };
90
 };
91
 
91
 
92
 
92
 
93
-Moderator.prototype.getFocusUserJid =  function () {
93
+Moderator.prototype.getFocusUserJid = function () {
94
     return this.focusUserJid;
94
     return this.focusUserJid;
95
 };
95
 };
96
 
96
 
97
-Moderator.prototype.getFocusComponent =  function () {
97
+Moderator.prototype.getFocusComponent = function () {
98
     // Get focus component address
98
     // Get focus component address
99
     var focusComponent = this.options.connection.hosts.focus;
99
     var focusComponent = this.options.connection.hosts.focus;
100
     // If not specified use default:  'focus.domain'
100
     // If not specified use default:  'focus.domain'
104
     return focusComponent;
104
     return focusComponent;
105
 };
105
 };
106
 
106
 
107
-Moderator.prototype.createConferenceIq =  function () {
107
+Moderator.prototype.createConferenceIq = function () {
108
     // Generate create conference IQ
108
     // Generate create conference IQ
109
     var elem = $iq({to: this.getFocusComponent(), type: 'set'});
109
     var elem = $iq({to: this.getFocusComponent(), type: 'set'});
110
 
110
 
218
 };
218
 };
219
 
219
 
220
 
220
 
221
-Moderator.prototype.parseSessionId =  function (resultIq) {
221
+Moderator.prototype.parseSessionId = function (resultIq) {
222
     var sessionId = $(resultIq).find('conference').attr('session-id');
222
     var sessionId = $(resultIq).find('conference').attr('session-id');
223
     if (sessionId) {
223
     if (sessionId) {
224
         logger.info('Received sessionId:  ' + sessionId);
224
         logger.info('Received sessionId:  ' + sessionId);
226
     }
226
     }
227
 };
227
 };
228
 
228
 
229
-Moderator.prototype.parseConfigOptions =  function (resultIq) {
229
+Moderator.prototype.parseConfigOptions = function (resultIq) {
230
 
230
 
231
     this.setFocusUserJid(
231
     this.setFocusUserJid(
232
         $(resultIq).find('conference').attr('focusjid'));
232
         $(resultIq).find('conference').attr('focusjid'));
274
  * @param {Function} callback - the function to be called back upon the
274
  * @param {Function} callback - the function to be called back upon the
275
  * successful allocation of the conference focus
275
  * successful allocation of the conference focus
276
  */
276
  */
277
-Moderator.prototype.allocateConferenceFocus =  function (callback) {
277
+Moderator.prototype.allocateConferenceFocus = function (callback) {
278
     // Try to use focus user JID from the config
278
     // Try to use focus user JID from the config
279
     this.setFocusUserJid(this.options.connection.focusUserJid);
279
     this.setFocusUserJid(this.options.connection.focusUserJid);
280
     // Send create conference IQ
280
     // Send create conference IQ
454
     this._getLoginUrl(/* popup */ true, urlCallback, failureCallback);
454
     this._getLoginUrl(/* popup */ true, urlCallback, failureCallback);
455
 };
455
 };
456
 
456
 
457
-Moderator.prototype.logout =  function (callback) {
457
+Moderator.prototype.logout = function (callback) {
458
     var iq = $iq({to: this.getFocusComponent(), type: 'set'});
458
     var iq = $iq({to: this.getFocusComponent(), type: 'set'});
459
     var sessionId = Settings.getSessionId();
459
     var sessionId = Settings.getSessionId();
460
     if (!sessionId) {
460
     if (!sessionId) {

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

17
     this.url = null;
17
     this.url = null;
18
     this.type = type;
18
     this.type = type;
19
     this._isSupported
19
     this._isSupported
20
-        =  type === Recording.types.JIRECON && !this.jirecon
20
+        = type === Recording.types.JIRECON && !this.jirecon
21
             || (type !== Recording.types.JIBRI
21
             || (type !== Recording.types.JIBRI
22
                 && type !== Recording.types.COLIBRI)
22
                 && type !== Recording.types.COLIBRI)
23
             ? false : true;
23
             ? false : true;
55
 
55
 
56
 Recording.prototype.handleJibriPresence = function (jibri) {
56
 Recording.prototype.handleJibriPresence = function (jibri) {
57
     var attributes = jibri.attributes;
57
     var attributes = jibri.attributes;
58
-    if(!attributes)        {
58
+    if(!attributes) {
59
         return;
59
         return;
60
     }
60
     }
61
 
61
 
62
     var newState = attributes.status;
62
     var newState = attributes.status;
63
     logger.log("Handle jibri presence : ", newState);
63
     logger.log("Handle jibri presence : ", newState);
64
 
64
 
65
-    if (newState === this.state)        {
65
+    if (newState === this.state) {
66
         return;
66
         return;
67
     }
67
     }
68
 
68
 
69
     if (newState === "undefined") {
69
     if (newState === "undefined") {
70
         this.state = Recording.status.UNAVAILABLE;
70
         this.state = Recording.status.UNAVAILABLE;
71
-    }    else if (newState === "off") {
71
+    } else if (newState === "off") {
72
         if (!this.state
72
         if (!this.state
73
             || this.state === "undefined"
73
             || this.state === "undefined"
74
-            || this.state === Recording.status.UNAVAILABLE)            {
74
+            || this.state === Recording.status.UNAVAILABLE) {
75
             this.state = Recording.status.AVAILABLE;
75
             this.state = Recording.status.AVAILABLE;
76
-        }        else            {
76
+        } else {
77
             this.state = Recording.status.OFF;
77
             this.state = Recording.status.OFF;
78
         }
78
         }
79
-    }    else {
79
+    } else {
80
         this.state = newState;
80
         this.state = newState;
81
     }
81
     }
82
 
82
 
225
 
225
 
226
     // If the recorder is currently unavailable we throw an error.
226
     // If the recorder is currently unavailable we throw an error.
227
     if (oldState === Recording.status.UNAVAILABLE
227
     if (oldState === Recording.status.UNAVAILABLE
228
-        || oldState === Recording.status.FAILED)        {
228
+        || oldState === Recording.status.FAILED) {
229
         statusChangeHandler(Recording.status.FAILED,
229
         statusChangeHandler(Recording.status.FAILED,
230
                             JitsiRecorderErrors.RECORDER_UNAVAILABLE);
230
                             JitsiRecorderErrors.RECORDER_UNAVAILABLE);
231
-    }    else if (oldState === Recording.status.BUSY)        {
231
+    } else if (oldState === Recording.status.BUSY) {
232
         statusChangeHandler(Recording.status.BUSY,
232
         statusChangeHandler(Recording.status.BUSY,
233
                             JitsiRecorderErrors.RECORDER_BUSY);
233
                             JitsiRecorderErrors.RECORDER_BUSY);
234
     }
234
     }

+ 5
- 5
modules/xmpp/strophe.emuc.js View File

61
         }
61
         }
62
 
62
 
63
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
63
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
64
-        if(!room)            {
64
+        if(!room) {
65
             return;
65
             return;
66
         }
66
         }
67
 
67
 
79
     onPresenceUnavailable (pres) {
79
     onPresenceUnavailable (pres) {
80
         const from = pres.getAttribute('from');
80
         const from = pres.getAttribute('from');
81
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
81
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
82
-        if(!room)            {
82
+        if(!room) {
83
             return;
83
             return;
84
         }
84
         }
85
 
85
 
90
     onPresenceError (pres) {
90
     onPresenceError (pres) {
91
         const from = pres.getAttribute('from');
91
         const from = pres.getAttribute('from');
92
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
92
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
93
-        if(!room)            {
93
+        if(!room) {
94
             return;
94
             return;
95
         }
95
         }
96
 
96
 
102
         // FIXME: this is a hack. but jingle on muc makes nickchanges hard
102
         // FIXME: this is a hack. but jingle on muc makes nickchanges hard
103
         const from = msg.getAttribute('from');
103
         const from = msg.getAttribute('from');
104
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
104
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
105
-        if(!room)            {
105
+        if(!room) {
106
             return;
106
             return;
107
         }
107
         }
108
 
108
 
113
     onMute(iq) {
113
     onMute(iq) {
114
         const from = iq.getAttribute('from');
114
         const from = iq.getAttribute('from');
115
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
115
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
116
-        if(!room)            {
116
+        if(!room) {
117
             return;
117
             return;
118
         }
118
         }
119
 
119
 

+ 4
- 4
modules/xmpp/xmpp.js View File

121
             this.connection.ping.hasPingSupport(
121
             this.connection.ping.hasPingSupport(
122
                 pingJid,
122
                 pingJid,
123
                 function (hasPing) {
123
                 function (hasPing) {
124
-                    if (hasPing)                        {
124
+                    if (hasPing) {
125
                         this.connection.ping.startInterval(pingJid);
125
                         this.connection.ping.startInterval(pingJid);
126
-                    }                    else                        {
126
+                    } else {
127
                         logger.warn("Ping NOT supported by " + pingJid);
127
                         logger.warn("Ping NOT supported by " + pingJid);
128
                     }
128
                     }
129
                 }.bind(this));
129
                 }.bind(this));
130
 
130
 
131
-            if (password)                {
131
+            if (password) {
132
                 this.authenticatedUser = true;
132
                 this.authenticatedUser = true;
133
             }
133
             }
134
             if (this.connection && this.connection.connected &&
134
             if (this.connection && this.connection.connected &&
268
     createRoom (roomName, options) {
268
     createRoom (roomName, options) {
269
         // By default MUC nickname is the resource part of the JID
269
         // By default MUC nickname is the resource part of the JID
270
         let mucNickname = Strophe.getNodeFromJid(this.connection.jid);
270
         let mucNickname = Strophe.getNodeFromJid(this.connection.jid);
271
-        let roomjid = roomName  + "@" + this.options.hosts.muc + "/";
271
+        let roomjid = roomName + "@" + this.options.hosts.muc + "/";
272
         const cfgNickname
272
         const cfgNickname
273
             = options.useNicks && options.nick ? options.nick : null;
273
             = options.useNicks && options.nick ? options.nick : null;
274
 
274
 

Loading…
Cancel
Save