Sfoglia il codice sorgente

fix(eslint): Add brace-style rule

master
hristoterezov 8 anni fa
parent
commit
f02a22d3f9
40 ha cambiato i file con 676 aggiunte e 523 eliminazioni
  1. 3
    0
      .eslintrc.js
  2. 66
    44
      JitsiConference.js
  3. 12
    8
      JitsiConferenceEventManager.js
  4. 7
    5
      JitsiConnection.js
  5. 1
    2
      JitsiMediaDevices.js
  6. 10
    7
      JitsiMeetJS.js
  7. 29
    20
      doc/example/example.js
  8. 13
    16
      modules/RTC/DataChannels.js
  9. 33
    25
      modules/RTC/JitsiLocalTrack.js
  10. 28
    20
      modules/RTC/JitsiRemoteTrack.js
  11. 28
    22
      modules/RTC/JitsiTrack.js
  12. 20
    12
      modules/RTC/RTC.js
  13. 3
    2
      modules/RTC/RTCBrowserType.js
  14. 19
    19
      modules/RTC/RTCUtils.js
  15. 19
    18
      modules/RTC/ScreenObtainer.js
  16. 6
    4
      modules/RTC/TraceablePeerConnection.js
  17. 9
    6
      modules/TalkMutedDetection.js
  18. 2
    4
      modules/connectivity/ConnectionQuality.js
  19. 10
    10
      modules/statistics/CallStats.js
  20. 8
    8
      modules/statistics/LocalStatsCollector.js
  21. 45
    40
      modules/statistics/RTPStatsCollector.js
  22. 55
    37
      modules/statistics/statistics.js
  23. 6
    12
      modules/transcription/audioRecorder.js
  24. 1
    2
      modules/transcription/transcriber.js
  25. 1
    2
      modules/transcription/transcriptionServices/AbstractTranscriptionService.js
  26. 6
    10
      modules/transcription/transcriptionServices/SphinxTranscriptionService.js
  27. 3
    2
      modules/util/EventEmitterForwarder.js
  28. 12
    8
      modules/util/GlobalOnErrorHandler.js
  29. 9
    6
      modules/util/ScriptUtil.js
  30. 3
    2
      modules/version/ComponentsVersions.js
  31. 1
    2
      modules/xmpp/Caps.js
  32. 61
    48
      modules/xmpp/ChatRoom.js
  33. 54
    31
      modules/xmpp/JingleSessionPC.js
  34. 26
    17
      modules/xmpp/SDP.js
  35. 11
    10
      modules/xmpp/SDPDiffer.js
  36. 7
    6
      modules/xmpp/SDPUtil.js
  37. 3
    1
      modules/xmpp/SdpTransformUtil.js
  38. 20
    18
      modules/xmpp/recording.js
  39. 15
    10
      modules/xmpp/strophe.emuc.js
  40. 11
    7
      modules/xmpp/xmpp.js

+ 3
- 0
.eslintrc.js Vedi File

@@ -77,6 +77,9 @@ module.exports = {
77 77
         'consistent-return': 0,
78 78
         'curly': 2,
79 79
 
80
+        // Stylistic issues group
81
+        'brace-style': 2,
82
+
80 83
         'prefer-const': 2,
81 84
         'prefer-reflect': 0,
82 85
         'prefer-spread': 2,

+ 66
- 44
JitsiConference.js Vedi File

@@ -94,8 +94,9 @@ function JitsiConference(options) {
94 94
  * @param connection {JitsiConnection} overrides this.connection
95 95
  */
96 96
 JitsiConference.prototype._init = function (options) {
97
-    if (!options)
98
-        {options = {};}
97
+    if (!options)        {
98
+options = {};
99
+}
99 100
 
100 101
     // Override connection and xmpp properties (Usefull if the connection
101 102
     // reloaded)
@@ -151,8 +152,9 @@ JitsiConference.prototype._init = function (options) {
151 152
  * @param password {string} the password
152 153
  */
153 154
 JitsiConference.prototype.join = function (password) {
154
-    if (this.room)
155
-        {this.room.join(password);}
155
+    if (this.room)        {
156
+this.room.join(password);
157
+}
156 158
 };
157 159
 
158 160
 /**
@@ -175,8 +177,9 @@ JitsiConference.prototype.leave = function () {
175 177
     this.getLocalTracks().forEach(track => this.onLocalTrackRemoved(track));
176 178
 
177 179
     this.rtc.closeAllDataChannels();
178
-    if (this.statistics)
179
-        {this.statistics.dispose();}
180
+    if (this.statistics)        {
181
+this.statistics.dispose();
182
+}
180 183
 
181 184
     // leave the conference
182 185
     if (this.room) {
@@ -294,8 +297,9 @@ JitsiConference.prototype.getLocalVideoTrack = function () {
294 297
  * Note: consider adding eventing functionality by extending an EventEmitter impl, instead of rolling ourselves
295 298
  */
296 299
 JitsiConference.prototype.on = function (eventId, handler) {
297
-    if (this.eventEmitter)
298
-        {this.eventEmitter.on(eventId, handler);}
300
+    if (this.eventEmitter)        {
301
+this.eventEmitter.on(eventId, handler);
302
+}
299 303
 };
300 304
 
301 305
 /**
@@ -306,8 +310,9 @@ JitsiConference.prototype.on = function (eventId, handler) {
306 310
  * Note: consider adding eventing functionality by extending an EventEmitter impl, instead of rolling ourselves
307 311
  */
308 312
 JitsiConference.prototype.off = function (eventId, handler) {
309
-    if (this.eventEmitter)
310
-        {this.eventEmitter.removeListener(eventId, handler);}
313
+    if (this.eventEmitter)        {
314
+this.eventEmitter.removeListener(eventId, handler);
315
+}
311 316
 };
312 317
 
313 318
 // Common aliases for event emitter
@@ -321,8 +326,9 @@ JitsiConference.prototype.removeEventListener = JitsiConference.prototype.off;
321 326
  * @param handler {Function} handler for the command
322 327
  */
323 328
  JitsiConference.prototype.addCommandListener = function (command, handler) {
324
-    if (this.room)
325
-        {this.room.addPresenceListener(command, handler);}
329
+    if (this.room)        {
330
+this.room.addPresenceListener(command, handler);
331
+}
326 332
  };
327 333
 
328 334
 /**
@@ -330,8 +336,9 @@ JitsiConference.prototype.removeEventListener = JitsiConference.prototype.off;
330 336
   * @param command {String} the name of the command
331 337
   */
332 338
  JitsiConference.prototype.removeCommandListener = function (command) {
333
-    if (this.room)
334
-        {this.room.removePresenceListener(command);}
339
+    if (this.room)        {
340
+this.room.removePresenceListener(command);
341
+}
335 342
  };
336 343
 
337 344
 /**
@@ -339,8 +346,9 @@ JitsiConference.prototype.removeEventListener = JitsiConference.prototype.off;
339 346
  * @param message the text message.
340 347
  */
341 348
 JitsiConference.prototype.sendTextMessage = function (message) {
342
-    if (this.room)
343
-        {this.room.sendMessage(message);}
349
+    if (this.room)        {
350
+this.room.sendMessage(message);
351
+}
344 352
 };
345 353
 
346 354
 /**
@@ -370,8 +378,9 @@ JitsiConference.prototype.sendCommandOnce = function (name, values) {
370 378
  * @param name {String} the name of the command.
371 379
  **/
372 380
 JitsiConference.prototype.removeCommand = function (name) {
373
-    if (this.room)
374
-        {this.room.removeFromPresence(name);}
381
+    if (this.room)        {
382
+this.room.removeFromPresence(name);
383
+}
375 384
 };
376 385
 
377 386
 /**
@@ -487,8 +496,9 @@ JitsiConference.prototype.onLocalTrackRemoved = function (track) {
487 496
     // send event for stopping screen sharing
488 497
     // FIXME: we assume we have only one screen sharing track
489 498
     // if we change this we need to fix this check
490
-    if (track.isVideoTrack() && track.videoType === VideoType.DESKTOP)
491
-        {this.statistics.sendScreenSharingEvent(false);}
499
+    if (track.isVideoTrack() && track.videoType === VideoType.DESKTOP)        {
500
+this.statistics.sendScreenSharingEvent(false);
501
+}
492 502
 
493 503
     this.eventEmitter.emit(JitsiConferenceEvents.TRACK_REMOVED, track);
494 504
 };
@@ -625,8 +635,9 @@ JitsiConference.prototype._setupNewTrack = function (newTrack) {
625 635
     // send event for starting screen sharing
626 636
     // FIXME: we assume we have only one screen sharing track
627 637
     // if we change this we need to fix this check
628
-    if (newTrack.isVideoTrack() && newTrack.videoType === VideoType.DESKTOP)
629
-        {this.statistics.sendScreenSharingEvent(true);}
638
+    if (newTrack.isVideoTrack() && newTrack.videoType === VideoType.DESKTOP)        {
639
+this.statistics.sendScreenSharingEvent(true);
640
+}
630 641
 
631 642
     this.eventEmitter.emit(JitsiConferenceEvents.TRACK_ADDED, newTrack);
632 643
 };
@@ -877,9 +888,10 @@ JitsiConference.prototype.onMemberLeft = function (jid) {
877 888
     }.bind(this));
878 889
 
879 890
     // there can be no participant in case the member that left is focus
880
-    if (participant)
881
-        {this.eventEmitter.emit(
882
-            JitsiConferenceEvents.USER_LEFT, id, participant);}
891
+    if (participant)        {
892
+this.eventEmitter.emit(
893
+            JitsiConferenceEvents.USER_LEFT, id, participant);
894
+}
883 895
 };
884 896
 
885 897
 JitsiConference.prototype.onUserRoleChanged = function (jid, role) {
@@ -899,8 +911,9 @@ JitsiConference.prototype.onDisplayNameChanged = function (jid, displayName) {
899 911
         return;
900 912
     }
901 913
 
902
-    if (participant._displayName === displayName)
903
-        {return;}
914
+    if (participant._displayName === displayName)        {
915
+return;
916
+}
904 917
 
905 918
     participant._displayName = displayName;
906 919
     this.eventEmitter.emit(JitsiConferenceEvents.DISPLAY_NAME_CHANGED, id, displayName);
@@ -1217,8 +1230,9 @@ JitsiConference.prototype.sendTones = function (tones, duration, pause) {
1217 1230
  * Returns true if recording is supported and false if not.
1218 1231
  */
1219 1232
 JitsiConference.prototype.isRecordingSupported = function () {
1220
-    if (this.room)
1221
-        {return this.room.isRecordingSupported();}
1233
+    if (this.room)        {
1234
+return this.room.isRecordingSupported();
1235
+}
1222 1236
     return false;
1223 1237
 };
1224 1238
 
@@ -1241,11 +1255,12 @@ JitsiConference.prototype.getRecordingURL = function () {
1241 1255
  * Starts/stops the recording
1242 1256
  */
1243 1257
 JitsiConference.prototype.toggleRecording = function (options) {
1244
-    if (this.room)
1245
-        {return this.room.toggleRecording(options, function (status, error) {
1258
+    if (this.room)        {
1259
+return this.room.toggleRecording(options, function (status, error) {
1246 1260
             this.eventEmitter.emit(
1247 1261
                 JitsiConferenceEvents.RECORDER_STATE_CHANGED, status, error);
1248
-        }.bind(this));}
1262
+        }.bind(this));
1263
+}
1249 1264
     this.eventEmitter.emit(
1250 1265
         JitsiConferenceEvents.RECORDER_STATE_CHANGED, "error",
1251 1266
         new Error("The conference is not created yet!"));
@@ -1255,8 +1270,9 @@ JitsiConference.prototype.toggleRecording = function (options) {
1255 1270
  * Returns true if the SIP calls are supported and false otherwise
1256 1271
  */
1257 1272
 JitsiConference.prototype.isSIPCallingSupported = function () {
1258
-    if (this.room)
1259
-        {return this.room.isSIPCallingSupported();}
1273
+    if (this.room)        {
1274
+return this.room.isSIPCallingSupported();
1275
+}
1260 1276
     return false;
1261 1277
 };
1262 1278
 
@@ -1265,28 +1281,33 @@ JitsiConference.prototype.isSIPCallingSupported = function () {
1265 1281
  * @param number the number
1266 1282
  */
1267 1283
 JitsiConference.prototype.dial = function (number) {
1268
-    if (this.room)
1269
-        {return this.room.dial(number);}
1284
+    if (this.room)        {
1285
+return this.room.dial(number);
1286
+}
1270 1287
     return new Promise(function(resolve, reject){
1271
-        reject(new Error("The conference is not created yet!"));});
1288
+        reject(new Error("The conference is not created yet!"));
1289
+});
1272 1290
 };
1273 1291
 
1274 1292
 /**
1275 1293
  * Hangup an existing call
1276 1294
  */
1277 1295
 JitsiConference.prototype.hangup = function () {
1278
-    if (this.room)
1279
-        {return this.room.hangup();}
1296
+    if (this.room)        {
1297
+return this.room.hangup();
1298
+}
1280 1299
     return new Promise(function(resolve, reject){
1281
-        reject(new Error("The conference is not created yet!"));});
1300
+        reject(new Error("The conference is not created yet!"));
1301
+});
1282 1302
 };
1283 1303
 
1284 1304
 /**
1285 1305
  * Returns the phone number for joining the conference.
1286 1306
  */
1287 1307
 JitsiConference.prototype.getPhoneNumber = function () {
1288
-    if (this.room)
1289
-        {return this.room.getPhoneNumber();}
1308
+    if (this.room)        {
1309
+return this.room.getPhoneNumber();
1310
+}
1290 1311
     return null;
1291 1312
 };
1292 1313
 
@@ -1294,8 +1315,9 @@ JitsiConference.prototype.getPhoneNumber = function () {
1294 1315
  * Returns the pin for joining the conference with phone.
1295 1316
  */
1296 1317
 JitsiConference.prototype.getPhonePin = function () {
1297
-    if (this.room)
1298
-        {return this.room.getPhonePin();}
1318
+    if (this.room)        {
1319
+return this.room.getPhonePin();
1320
+}
1299 1321
     return null;
1300 1322
 };
1301 1323
 

+ 12
- 8
JitsiConferenceEventManager.js Vedi File

@@ -23,8 +23,9 @@ function JitsiConferenceEventManager(conference) {
23 23
     //Listeners related to the conference only
24 24
     conference.on(JitsiConferenceEvents.TRACK_MUTE_CHANGED,
25 25
         function (track) {
26
-            if(!track.isLocal() || !conference.statistics)
27
-                {return;}
26
+            if(!track.isLocal() || !conference.statistics)                {
27
+return;
28
+}
28 29
             conference.statistics.sendMuteEvent(track.isMuted(),
29 30
                 track.getType());
30 31
         });
@@ -527,13 +528,15 @@ JitsiConferenceEventManager.prototype.setupXMPPListeners = function () {
527 528
  */
528 529
 JitsiConferenceEventManager.prototype.setupStatisticsListeners = function () {
529 530
     var conference = this.conference;
530
-    if(!conference.statistics)
531
-        {return;}
531
+    if(!conference.statistics)        {
532
+return;
533
+}
532 534
 
533 535
     conference.statistics.addAudioLevelListener(function (ssrc, level) {
534 536
         var resource = conference.rtc.getResourceBySSRC(ssrc);
535
-        if (!resource)
536
-            {return;}
537
+        if (!resource)            {
538
+return;
539
+}
537 540
 
538 541
         conference.rtc.setAudioLevel(resource, level);
539 542
     });
@@ -578,8 +581,9 @@ JitsiConferenceEventManager.prototype.setupStatisticsListeners = function () {
578 581
     conference.statistics.addByteSentStatsListener(function (stats) {
579 582
         conference.getLocalTracks(MediaType.AUDIO).forEach(function (track) {
580 583
             const ssrc = track.getSSRC();
581
-            if (!ssrc || !stats.hasOwnProperty(ssrc))
582
-                {return;}
584
+            if (!ssrc || !stats.hasOwnProperty(ssrc))                {
585
+return;
586
+}
583 587
 
584 588
             track._setByteSent(stats[ssrc]);
585 589
         });

+ 7
- 5
JitsiConnection.js Vedi File

@@ -29,9 +29,10 @@ function JitsiConnection(appID, token, options) {
29 29
             // we can see disconnects from normal tab closing of the browser
30 30
             // and then there are no msgs, but we want to log only disconnects
31 31
             // when there is real error
32
-            if(msg)
33
-                {Statistics.analytics.sendEvent(
34
-                    'connection.disconnected.' + msg);}
32
+            if(msg)                {
33
+Statistics.analytics.sendEvent(
34
+                    'connection.disconnected.' + msg);
35
+}
35 36
             Statistics.sendLog(
36 37
                 JSON.stringify({id: "connection.disconnected", msg: msg}));
37 38
         });
@@ -43,8 +44,9 @@ function JitsiConnection(appID, token, options) {
43 44
  * (for example authentications parameters).
44 45
  */
45 46
 JitsiConnection.prototype.connect = function (options) {
46
-    if(!options)
47
-        {options = {};}
47
+    if(!options)        {
48
+options = {};
49
+}
48 50
 
49 51
     this.xmpp.connect(options.id, options.password);
50 52
 };

+ 1
- 2
JitsiMediaDevices.js Vedi File

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

+ 10
- 7
JitsiMeetJS.js Vedi File

@@ -31,8 +31,9 @@ const logger = Logger.getLogger(__filename);
31 31
 var USER_MEDIA_PERMISSION_PROMPT_TIMEOUT = 500;
32 32
 
33 33
 function getLowerResolution(resolution) {
34
-    if(!Resolutions[resolution])
35
-        {return null;}
34
+    if(!Resolutions[resolution])        {
35
+return null;
36
+}
36 37
     var order = Resolutions[resolution].order;
37 38
     var res = null;
38 39
     var resName = null;
@@ -223,8 +224,9 @@ var LibJitsiMeet = {
223 224
             }, USER_MEDIA_PERMISSION_PROMPT_TIMEOUT);
224 225
         }
225 226
 
226
-        if(!window.connectionTimes)
227
-            {window.connectionTimes = {};}
227
+        if(!window.connectionTimes)            {
228
+window.connectionTimes = {};
229
+}
228 230
         window.connectionTimes["obtainPermissions.start"] =
229 231
             window.performance.now();
230 232
 
@@ -238,8 +240,8 @@ var LibJitsiMeet = {
238 240
                 Statistics.analytics.sendEvent(addDeviceTypeToAnalyticsEvent(
239 241
                     "getUserMedia.success", options), {value: options});
240 242
 
241
-                if(!RTC.options.disableAudioLevels)
242
-                    {for(let i = 0; i < tracks.length; i++) {
243
+                if(!RTC.options.disableAudioLevels)                    {
244
+for(let i = 0; i < tracks.length; i++) {
243 245
                         const track = tracks[i];
244 246
                         var mStream = track.getOriginalStream();
245 247
                         if(track.getType() === MediaType.AUDIO){
@@ -251,7 +253,8 @@ var LibJitsiMeet = {
251 253
                                     Statistics.stopLocalStats(mStream);
252 254
                                 });
253 255
                         }
254
-                    }}
256
+                    }
257
+}
255 258
 
256 259
                 // set real device ids
257 260
                 var currentlyAvailableMediaDevices

+ 29
- 20
doc/example/example.js Vedi File

@@ -19,11 +19,9 @@ var isJoined = false;
19 19
  * Handles local tracks.
20 20
  * @param tracks Array with JitsiTrack objects
21 21
  */
22
-function onLocalTracks(tracks)
23
-{
22
+function onLocalTracks(tracks){
24 23
     localTracks = tracks;
25
-    for(var i = 0; i < localTracks.length; i++)
26
-    {
24
+    for(var i = 0; i < localTracks.length; i++)    {
27 25
         localTracks[i].addEventListener(JitsiMeetJS.events.track.TRACK_AUDIO_LEVEL_CHANGED,
28 26
             function (audioLevel) {
29 27
                 console.log("Audio Level local: " + audioLevel);
@@ -47,8 +45,9 @@ function onLocalTracks(tracks)
47 45
             $("body").append("<audio autoplay='1' muted='true' id='localAudio" + i + "' />");
48 46
             localTracks[i].attach($("#localAudio" + i)[0]);
49 47
         }
50
-        if(isJoined)
51
-            {room.addTrack(localTracks[i]);}
48
+        if(isJoined)            {
49
+room.addTrack(localTracks[i]);
50
+}
52 51
     }
53 52
 }
54 53
 
@@ -57,11 +56,13 @@ function onLocalTracks(tracks)
57 56
  * @param track JitsiTrack object
58 57
  */
59 58
 function onRemoteTrack(track) {
60
-    if(track.isLocal())
61
-        {return;}
59
+    if(track.isLocal())        {
60
+return;
61
+}
62 62
     var participant = track.getParticipantId();
63
-    if(!remoteTracks[participant])
64
-        {remoteTracks[participant] = [];}
63
+    if(!remoteTracks[participant])        {
64
+remoteTracks[participant] = [];
65
+}
65 66
     var idx = remoteTracks[participant].push(track);
66 67
     track.addEventListener(JitsiMeetJS.events.track.TRACK_AUDIO_LEVEL_CHANGED,
67 68
         function (audioLevel) {
@@ -94,17 +95,20 @@ function onRemoteTrack(track) {
94 95
 function onConferenceJoined () {
95 96
     console.log("conference joined!");
96 97
     isJoined = true;
97
-    for(var i = 0; i < localTracks.length; i++)
98
-        {room.addTrack(localTracks[i]);}
98
+    for(var i = 0; i < localTracks.length; i++)        {
99
+room.addTrack(localTracks[i]);
100
+}
99 101
 }
100 102
 
101 103
 function onUserLeft(id) {
102 104
     console.log("user left");
103
-    if(!remoteTracks[id])
104
-        {return;}
105
+    if(!remoteTracks[id])        {
106
+return;
107
+}
105 108
     var tracks = remoteTracks[id];
106
-    for(var i = 0; i< tracks.length; i++)
107
-        {tracks[i].detach($("#" + id + tracks[i].getType()));}
109
+    for(var i = 0; i< tracks.length; i++)        {
110
+tracks[i].detach($("#" + id + tracks[i].getType()));
111
+}
108 112
 }
109 113
 
110 114
 /**
@@ -117,7 +121,9 @@ function onConnectionSuccess(){
117 121
         console.log("track removed!!!" + track);
118 122
     });
119 123
     room.on(JitsiMeetJS.events.conference.CONFERENCE_JOINED, onConferenceJoined);
120
-    room.on(JitsiMeetJS.events.conference.USER_JOINED, function(id){ console.log("user join");remoteTracks[id] = [];});
124
+    room.on(JitsiMeetJS.events.conference.USER_JOINED, function(id){
125
+ console.log("user join");remoteTracks[id] = [];
126
+});
121 127
     room.on(JitsiMeetJS.events.conference.USER_LEFT, onUserLeft);
122 128
     room.on(JitsiMeetJS.events.conference.TRACK_MUTE_CHANGED, function (track) {
123 129
         console.log(track.getType() + " - " + track.isMuted());
@@ -167,8 +173,9 @@ function disconnect(){
167 173
 }
168 174
 
169 175
 function unload() {
170
-    for(var i = 0; i < localTracks.length; i++)
171
-        {localTracks[i].stop();}
176
+    for(var i = 0; i < localTracks.length; i++)        {
177
+localTracks[i].stop();
178
+}
172 179
     room.leave();
173 180
     connection.disconnect();
174 181
 }
@@ -252,7 +259,9 @@ JitsiMeetJS.init(initOptions).then(function(){
252 259
 
253 260
 if (JitsiMeetJS.mediaDevices.isDeviceChangeAvailable('output')) {
254 261
     JitsiMeetJS.mediaDevices.enumerateDevices(function(devices) {
255
-        var audioOutputDevices = devices.filter(function(d) { return d.kind === 'audiooutput'; });
262
+        var audioOutputDevices = devices.filter(function(d) {
263
+ return d.kind === 'audiooutput'; 
264
+});
256 265
 
257 266
         if (audioOutputDevices.length > 1) {
258 267
             $('#audioOutputSelect').html(

+ 13
- 16
modules/RTC/DataChannels.js Vedi File

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

+ 33
- 25
modules/RTC/JitsiLocalTrack.js Vedi File

@@ -34,9 +34,10 @@ function JitsiLocalTrack(stream, track, mediaType, videoType, resolution,
34 34
     JitsiTrack.call(this,
35 35
         null /* RTC */, stream, track,
36 36
         function () {
37
-            if(!this.dontFireRemoveEvent)
38
-                {this.eventEmitter.emit(
39
-                    JitsiTrackEvents.LOCAL_TRACK_STOPPED);}
37
+            if(!this.dontFireRemoveEvent)                {
38
+this.eventEmitter.emit(
39
+                    JitsiTrackEvents.LOCAL_TRACK_STOPPED);
40
+}
40 41
             this.dontFireRemoveEvent = false;
41 42
         }.bind(this) /* inactiveHandler */,
42 43
         mediaType, videoType, null /* ssrc */);
@@ -45,8 +46,9 @@ function JitsiLocalTrack(stream, track, mediaType, videoType, resolution,
45 46
 
46 47
     // FIXME: currently firefox is ignoring our constraints about resolutions
47 48
     // so we do not store it, to avoid wrong reporting of local track resolution
48
-    if (RTCBrowserType.isFirefox())
49
-        {this.resolution = null;}
49
+    if (RTCBrowserType.isFirefox())        {
50
+this.resolution = null;
51
+}
50 52
 
51 53
     this.deviceId = deviceId;
52 54
     this.startMuted = false;
@@ -182,8 +184,9 @@ JitsiLocalTrack.prototype._clearNoDataFromSourceMuteResources = function () {
182 184
  */
183 185
 JitsiLocalTrack.prototype._onNoDataFromSourceError = function () {
184 186
     this._clearNoDataFromSourceMuteResources();
185
-    if(this._checkForCameraIssues())
186
-        {this._fireNoDataFromSourceEvent();}
187
+    if(this._checkForCameraIssues())        {
188
+this._fireNoDataFromSourceEvent();
189
+}
187 190
 };
188 191
 
189 192
 /**
@@ -292,8 +295,9 @@ JitsiLocalTrack.prototype._setMute = function (mute) {
292 295
     if (this.isAudioTrack() ||
293 296
         this.videoType === VideoType.DESKTOP ||
294 297
         RTCBrowserType.isFirefox()) {
295
-        if(this.track)
296
-            {this.track.enabled = !mute;}
298
+        if(this.track)            {
299
+this.track.enabled = !mute;
300
+}
297 301
     } else {
298 302
         if(mute) {
299 303
             this.dontFireRemoveEvent = true;
@@ -315,8 +319,9 @@ JitsiLocalTrack.prototype._setMute = function (mute) {
315 319
                 devices: [ MediaType.VIDEO ],
316 320
                 facingMode: this.getCameraFacingMode()
317 321
             };
318
-            if (this.resolution)
319
-                {streamOptions.resolution = this.resolution;}
322
+            if (this.resolution)                {
323
+streamOptions.resolution = this.resolution;
324
+}
320 325
 
321 326
             promise = RTCUtils.obtainAudioAndVideoPermissions(streamOptions)
322 327
                 .then(function (streamsInfo) {
@@ -474,8 +479,9 @@ JitsiLocalTrack.prototype.dispose = function () {
474 479
  */
475 480
 JitsiLocalTrack.prototype.isMuted = function () {
476 481
     // this.stream will be null when we mute local video on Chrome
477
-    if (!this.stream)
478
-        {return true;}
482
+    if (!this.stream)        {
483
+return true;
484
+}
479 485
     if (this.isVideoTrack() && !this.isActive()) {
480 486
         return true;
481 487
     } else {
@@ -504,8 +510,7 @@ JitsiLocalTrack.prototype._setConference = function(conference) {
504 510
     // on "attach" call, but for local track we not always have the conference
505 511
     // before attaching. However this may result in duplicated events if they
506 512
     // have been triggered on "attach" already.
507
-    for(var i = 0; i < this.containers.length; i++)
508
-    {
513
+    for(var i = 0; i < this.containers.length; i++)    {
509 514
         this._maybeFireTrackAttached(this.containers[i]);
510 515
     }
511 516
 };
@@ -518,12 +523,13 @@ JitsiLocalTrack.prototype._setConference = function(conference) {
518 523
  * @returns {string} or {null}
519 524
  */
520 525
 JitsiLocalTrack.prototype.getSSRC = function () {
521
-    if(this.ssrc && this.ssrc.groups && this.ssrc.groups.length)
522
-        {return this.ssrc.groups[0].ssrcs[0];}
523
-    else if(this.ssrc && this.ssrc.ssrcs && this.ssrc.ssrcs.length)
524
-        {return this.ssrc.ssrcs[0];}
525
-    else
526
-        {return null;}
526
+    if(this.ssrc && this.ssrc.groups && this.ssrc.groups.length)        {
527
+return this.ssrc.groups[0].ssrcs[0];
528
+}    else if(this.ssrc && this.ssrc.ssrcs && this.ssrc.ssrcs.length)        {
529
+return this.ssrc.ssrcs[0];
530
+}    else        {
531
+return null;
532
+}
527 533
 };
528 534
 
529 535
 /**
@@ -621,8 +627,9 @@ JitsiLocalTrack.prototype._stopMediaStream = function () {
621 627
  */
622 628
 JitsiLocalTrack.prototype._checkForCameraIssues = function () {
623 629
     if(!this.isVideoTrack() || this.stopStreamInProgress ||
624
-        this.videoType === VideoType.DESKTOP)
625
-        {return false;}
630
+        this.videoType === VideoType.DESKTOP)        {
631
+return false;
632
+}
626 633
 
627 634
     return !this._isReceivingData();
628 635
 };
@@ -637,8 +644,9 @@ JitsiLocalTrack.prototype._checkForCameraIssues = function () {
637 644
  * @returns {boolean} true if the stream is receiving data and false otherwise.
638 645
  */
639 646
 JitsiLocalTrack.prototype._isReceivingData = function () {
640
-    if(!this.stream)
641
-        {return false;}
647
+    if(!this.stream)        {
648
+return false;
649
+}
642 650
     // In older version of the spec there is no muted property and
643 651
     // readyState can have value muted. In the latest versions
644 652
     // readyState can have values "live" and "ended" and there is

+ 28
- 20
modules/RTC/JitsiRemoteTrack.js Vedi File

@@ -37,8 +37,9 @@ function JitsiRemoteTrack(rtc, conference, ownerEndpointId, stream, track,
37 37
     // increase ttfm values
38 38
     this.hasBeenMuted = muted;
39 39
     // Bind 'onmute' and 'onunmute' event handlers
40
-    if (this.rtc && this.track)
41
-        {this._bindMuteHandlers();}
40
+    if (this.rtc && this.track)        {
41
+this._bindMuteHandlers();
42
+}
42 43
 }
43 44
 
44 45
 JitsiRemoteTrack.prototype = Object.create(JitsiTrack.prototype);
@@ -76,15 +77,18 @@ JitsiRemoteTrack.prototype._bindMuteHandlers = function() {
76 77
  * @param value the muted status.
77 78
  */
78 79
 JitsiRemoteTrack.prototype.setMute = function (value) {
79
-    if(this.muted === value)
80
-        {return;}
80
+    if(this.muted === value)        {
81
+return;
82
+}
81 83
 
82
-    if(value)
83
-        {this.hasBeenMuted = true;}
84
+    if(value)        {
85
+this.hasBeenMuted = true;
86
+}
84 87
 
85 88
     // we can have a fake video stream
86
-    if(this.stream)
87
-        {this.stream.muted = value;}
89
+    if(this.stream)        {
90
+this.stream.muted = value;
91
+}
88 92
 
89 93
     this.muted = value;
90 94
     this.eventEmitter.emit(JitsiTrackEvents.TRACK_MUTE_CHANGED, this);
@@ -128,8 +132,9 @@ JitsiRemoteTrack.prototype.getSSRC = function () {
128 132
  * @param type the new video type("camera", "desktop")
129 133
  */
130 134
 JitsiRemoteTrack.prototype._setVideoType = function (type) {
131
-    if(this.videoType === type)
132
-        {return;}
135
+    if(this.videoType === type)        {
136
+return;
137
+}
133 138
     this.videoType = type;
134 139
     this.eventEmitter.emit(JitsiTrackEvents.TRACK_VIDEOTYPE_CHANGED, type);
135 140
 };
@@ -149,8 +154,9 @@ JitsiRemoteTrack.prototype._playCallback = function () {
149 154
     this.conference.getConnectionTimes()[type + ".ttfm"] = ttfm;
150 155
     console.log("(TIME) TTFM " + type + ":\t", ttfm);
151 156
     var eventName = type +'.ttfm';
152
-    if(this.hasBeenMuted)
153
-        {eventName += '.muted';}
157
+    if(this.hasBeenMuted)        {
158
+eventName += '.muted';
159
+}
154 160
     Statistics.analytics.sendEvent(eventName, {value: ttfm});
155 161
 };
156 162
 
@@ -164,13 +170,16 @@ JitsiRemoteTrack.prototype._playCallback = function () {
164 170
  */
165 171
 JitsiRemoteTrack.prototype._attachTTFMTracker = function (container) {
166 172
     if((ttfmTrackerAudioAttached && this.isAudioTrack())
167
-        || (ttfmTrackerVideoAttached && this.isVideoTrack()))
168
-        {return;}
173
+        || (ttfmTrackerVideoAttached && this.isVideoTrack()))        {
174
+return;
175
+}
169 176
 
170
-    if (this.isAudioTrack())
171
-        {ttfmTrackerAudioAttached = true;}
172
-    if (this.isVideoTrack())
173
-        {ttfmTrackerVideoAttached = true;}
177
+    if (this.isAudioTrack())        {
178
+ttfmTrackerAudioAttached = true;
179
+}
180
+    if (this.isVideoTrack())        {
181
+ttfmTrackerVideoAttached = true;
182
+}
174 183
 
175 184
     if (RTCBrowserType.isTemasysPluginUsed()) {
176 185
         // XXX Don't require Temasys unless it's to be used because it doesn't
@@ -179,8 +188,7 @@ JitsiRemoteTrack.prototype._attachTTFMTracker = function (container) {
179 188
 
180 189
         // FIXME: this is not working for IE11
181 190
         AdapterJS.addEvent(container, 'play', this._playCallback.bind(this));
182
-    }
183
-    else {
191
+    }    else {
184 192
         container.addEventListener("canplay", this._playCallback.bind(this));
185 193
     }
186 194
 };

+ 28
- 22
modules/RTC/JitsiTrack.js Vedi File

@@ -26,8 +26,9 @@ var trackHandler2Prop = {
26 26
 function implementOnEndedHandling(jitsiTrack) {
27 27
     var stream = jitsiTrack.getOriginalStream();
28 28
 
29
-    if(!stream)
30
-        {return;}
29
+    if(!stream)        {
30
+return;
31
+}
31 32
 
32 33
     var originalStop = stream.stop;
33 34
     stream.stop = function () {
@@ -45,10 +46,11 @@ function implementOnEndedHandling(jitsiTrack) {
45 46
  */
46 47
 function addMediaStreamInactiveHandler(mediaStream, handler) {
47 48
     // Temasys will use onended
48
-    if(typeof mediaStream.active !== "undefined")
49
-        {mediaStream.oninactive = handler;}
50
-    else
51
-        {mediaStream.onended = handler;}
49
+    if(typeof mediaStream.active !== "undefined")        {
50
+mediaStream.oninactive = handler;
51
+}    else        {
52
+mediaStream.onended = handler;
53
+}
52 54
 }
53 55
 
54 56
 /**
@@ -65,8 +67,7 @@ function addMediaStreamInactiveHandler(mediaStream, handler) {
65 67
  * @param ssrc the SSRC of this track if known
66 68
  */
67 69
 function JitsiTrack(conference, stream, track, streamInactiveHandler, trackMediaType,
68
-                    videoType, ssrc)
69
-{
70
+                    videoType, ssrc){
70 71
     /**
71 72
      * Array with the HTML elements that are displaying the streams.
72 73
      * @type {Array}
@@ -101,8 +102,9 @@ function JitsiTrack(conference, stream, track, streamInactiveHandler, trackMedia
101 102
  */
102 103
 JitsiTrack.prototype._setHandler = function (type, handler) {
103 104
     this.handlers[type] = handler;
104
-    if(!this.stream)
105
-        {return;}
105
+    if(!this.stream)        {
106
+return;
107
+}
106 108
 
107 109
     if(type === "inactive") {
108 110
         if (RTCBrowserType.isFirefox()) {
@@ -315,10 +317,11 @@ JitsiTrack.prototype.isScreenSharing = function() {
315 317
  * @returns {string|null} id of the track or null if this is fake track.
316 318
  */
317 319
 JitsiTrack.prototype.getId = function () {
318
-    if(this.stream)
319
-        {return RTCUtils.getStreamID(this.stream);}
320
-    else
321
-        {return null;}
320
+    if(this.stream)        {
321
+return RTCUtils.getStreamID(this.stream);
322
+}    else        {
323
+return null;
324
+}
322 325
 };
323 326
 
324 327
 /**
@@ -328,10 +331,11 @@ JitsiTrack.prototype.getId = function () {
328 331
  * @returns {boolean} whether MediaStream is active.
329 332
  */
330 333
 JitsiTrack.prototype.isActive = function () {
331
-    if(typeof this.stream.active !== "undefined")
332
-        {return this.stream.active;}
333
-    else
334
-        {return true;}
334
+    if(typeof this.stream.active !== "undefined")        {
335
+return this.stream.active;
336
+}    else        {
337
+return true;
338
+}
335 339
 };
336 340
 
337 341
 /**
@@ -341,8 +345,9 @@ JitsiTrack.prototype.isActive = function () {
341 345
  * @param handler handler for the event.
342 346
  */
343 347
 JitsiTrack.prototype.on = function (eventId, handler) {
344
-    if(this.eventEmitter)
345
-        {this.eventEmitter.on(eventId, handler);}
348
+    if(this.eventEmitter)        {
349
+this.eventEmitter.on(eventId, handler);
350
+}
346 351
 };
347 352
 
348 353
 /**
@@ -351,8 +356,9 @@ JitsiTrack.prototype.on = function (eventId, handler) {
351 356
  * @param [handler] optional, the specific handler to unbind
352 357
  */
353 358
 JitsiTrack.prototype.off = function (eventId, handler) {
354
-    if(this.eventEmitter)
355
-        {this.eventEmitter.removeListener(eventId, handler);}
359
+    if(this.eventEmitter)        {
360
+this.eventEmitter.removeListener(eventId, handler);
361
+}
356 362
 };
357 363
 
358 364
 // Common aliases for event emitter

+ 20
- 12
modules/RTC/RTC.js Vedi File

@@ -164,8 +164,9 @@ export default class RTC extends Listenable {
164 164
     selectEndpoint (id) {
165 165
         // cache the value if channel is missing, till we open it
166 166
         this.selectedEndpoint = id;
167
-        if(this.dataChannels && this.dataChannelsOpen)
168
-            {this.dataChannels.sendSelectedEndpointMessage(id);}
167
+        if(this.dataChannels && this.dataChannelsOpen)            {
168
+this.dataChannels.sendSelectedEndpointMessage(id);
169
+}
169 170
     }
170 171
 
171 172
     /**
@@ -252,8 +253,9 @@ export default class RTC extends Listenable {
252 253
     }
253 254
 
254 255
     addLocalTrack (track) {
255
-        if (!track)
256
-            {throw new Error('track must not be null nor undefined');}
256
+        if (!track)            {
257
+throw new Error('track must not be null nor undefined');
258
+}
257 259
 
258 260
         this.localTracks.push(track);
259 261
 
@@ -288,7 +290,9 @@ export default class RTC extends Listenable {
288 290
         let tracks = this.localTracks.slice();
289 291
         if (mediaType !== undefined) {
290 292
             tracks = tracks.filter(
291
-                (track) => { return track.getType() === mediaType; });
293
+                (track) => {
294
+ return track.getType() === mediaType; 
295
+});
292 296
         }
293 297
         return tracks;
294 298
     }
@@ -330,10 +334,11 @@ export default class RTC extends Listenable {
330 334
      * @returns {JitsiRemoteTrack|null}
331 335
      */
332 336
     getRemoteTrackByType (type, resource) {
333
-        if (this.remoteTracks[resource])
334
-            {return this.remoteTracks[resource][type];}
335
-        else
336
-            {return null;}
337
+        if (this.remoteTracks[resource])            {
338
+return this.remoteTracks[resource][type];
339
+}        else            {
340
+return null;
341
+}
337 342
     }
338 343
 
339 344
     /**
@@ -632,8 +637,9 @@ export default class RTC extends Listenable {
632 637
     dispose () { }
633 638
 
634 639
     setAudioLevel (resource, audioLevel) {
635
-        if(!resource)
636
-            {return;}
640
+        if(!resource)            {
641
+return;
642
+}
637 643
         var audioTrack = this.getRemoteAudioTrack(resource);
638 644
         if(audioTrack) {
639 645
             audioTrack.setAudioLevel(audioLevel);
@@ -647,7 +653,9 @@ export default class RTC extends Listenable {
647 653
      */
648 654
     getResourceBySSRC (ssrc) {
649 655
         if (this.getLocalTracks().find(
650
-                localTrack => { return localTrack.getSSRC() == ssrc; })) {
656
+                localTrack => {
657
+ return localTrack.getSSRC() == ssrc; 
658
+})) {
651 659
             return this.conference.myUserId();
652 660
         }
653 661
 

+ 3
- 2
modules/RTC/RTCBrowserType.js Vedi File

@@ -335,8 +335,9 @@ function detectBrowser() {
335 335
     // Try all browser detectors
336 336
     for (var i = 0; i < detectors.length; i++) {
337 337
         version = detectors[i]();
338
-        if (version)
339
-            {return version;}
338
+        if (version)            {
339
+return version;
340
+}
340 341
     }
341 342
     logger.warn("Browser type defaults to Safari ver 1");
342 343
     currentBrowser = RTCBrowserType.RTC_BROWSER_SAFARI;

+ 19
- 19
modules/RTC/RTCUtils.js Vedi File

@@ -107,8 +107,7 @@ function setResolutionConstraints(constraints, resolution) {
107 107
     if (Resolutions[resolution]) {
108 108
         constraints.video.mandatory.minWidth = Resolutions[resolution].width;
109 109
         constraints.video.mandatory.minHeight = Resolutions[resolution].height;
110
-    }
111
-    else if (isAndroid) {
110
+    }    else if (isAndroid) {
112 111
         // FIXME can't remember if the purpose of this was to always request
113 112
         //       low resolution on Android ? if yes it should be moved up front
114 113
         constraints.video.mandatory.minWidth = 320;
@@ -116,12 +115,14 @@ function setResolutionConstraints(constraints, resolution) {
116 115
         constraints.video.mandatory.maxFrameRate = 15;
117 116
     }
118 117
 
119
-    if (constraints.video.mandatory.minWidth)
120
-        {constraints.video.mandatory.maxWidth =
121
-            constraints.video.mandatory.minWidth;}
122
-    if (constraints.video.mandatory.minHeight)
123
-        {constraints.video.mandatory.maxHeight =
124
-            constraints.video.mandatory.minHeight;}
118
+    if (constraints.video.mandatory.minWidth)        {
119
+constraints.video.mandatory.maxWidth =
120
+            constraints.video.mandatory.minWidth;
121
+}
122
+    if (constraints.video.mandatory.minHeight)        {
123
+constraints.video.mandatory.maxHeight =
124
+            constraints.video.mandatory.minHeight;
125
+}
125 126
 }
126 127
 
127 128
 /**
@@ -293,8 +294,7 @@ function getConstraints(um, options) {
293 294
     // we turn audio for both audio and video tracks, the fake audio & video seems to work
294 295
     // only when enabled in one getUserMedia call, we cannot get fake audio separate by fake video
295 296
     // this later can be a problem with some of the tests
296
-    if(RTCBrowserType.isFirefox() && options.firefox_fake_device)
297
-    {
297
+    if(RTCBrowserType.isFirefox() && options.firefox_fake_device)    {
298 298
         // seems to be fixed now, removing this experimental fix, as having
299 299
         // multiple audio tracks brake the tests
300 300
         //constraints.audio = true;
@@ -771,8 +771,9 @@ class RTCUtils extends Listenable {
771 771
                     // https://github.com/webrtc/samples/issues/302
772 772
                     if (element) {
773 773
                         defaultSetVideoSrc(element, stream);
774
-                        if (stream)
775
-                            {element.play();}
774
+                        if (stream)                            {
775
+element.play();
776
+}
776 777
                     }
777 778
                     return element;
778 779
                 });
@@ -851,9 +852,8 @@ class RTCUtils extends Listenable {
851 852
                         return this.audioTracks;
852 853
                     };
853 854
                 }
854
-            }
855
-            // Detect IE/Safari
856
-            else if (RTCBrowserType.isTemasysPluginUsed()) {
855
+            } else if (RTCBrowserType.isTemasysPluginUsed()) {
856
+                // Detect IE/Safari
857 857
                 const webRTCReadyCb = () => {
858 858
                     this.peerconnection = RTCPeerConnection;
859 859
                     this.getUserMedia = window.getUserMedia;
@@ -1054,8 +1054,7 @@ class RTCUtils extends Listenable {
1054 1054
                             var videoTracksReceived = !!stream.getVideoTracks().length;
1055 1055
 
1056 1056
                             if((audioDeviceRequested && !audioTracksReceived) ||
1057
-                                (videoDeviceRequested && !videoTracksReceived))
1058
-                            {
1057
+                                (videoDeviceRequested && !videoTracksReceived))                            {
1059 1058
                                 self.stopMediaStream(stream);
1060 1059
 
1061 1060
                                 // We are getting here in case if we requested
@@ -1145,8 +1144,9 @@ class RTCUtils extends Listenable {
1145 1144
     }
1146 1145
 
1147 1146
     _isDeviceListAvailable () {
1148
-        if (!rtcReady)
1149
-            {throw new Error("WebRTC not ready yet");}
1147
+        if (!rtcReady)            {
1148
+throw new Error("WebRTC not ready yet");
1149
+}
1150 1150
         var isEnumerateDevicesAvailable
1151 1151
             = navigator.mediaDevices && navigator.mediaDevices.enumerateDevices;
1152 1152
         if (isEnumerateDevicesAvailable) {

+ 19
- 18
modules/RTC/ScreenObtainer.js Vedi File

@@ -73,8 +73,9 @@ var ScreenObtainer = {
73 73
         this.options = options = options || {};
74 74
         gumFunction = gum;
75 75
 
76
-        if (RTCBrowserType.isFirefox())
77
-            {initFirefoxExtensionDetection(options);}
76
+        if (RTCBrowserType.isFirefox())            {
77
+initFirefoxExtensionDetection(options);
78
+}
78 79
 
79 80
         if (RTCBrowserType.isNWJS()) {
80 81
             obtainDesktopStream = (options, onSuccess, onFailure) => {
@@ -206,8 +207,9 @@ var ScreenObtainer = {
206 207
         if (firefoxExtInstalled === null) {
207 208
             window.setTimeout(
208 209
                 () => {
209
-                    if (firefoxExtInstalled === null)
210
-                        {firefoxExtInstalled = false;}
210
+                    if (firefoxExtInstalled === null)                        {
211
+firefoxExtInstalled = false;
212
+}
211 213
                     this.obtainScreenOnFirefox(callback, errorCallback);
212 214
                 },
213 215
                 300);
@@ -331,8 +333,7 @@ function obtainWebRTCScreen(options, streamCallback, failCallback) {
331 333
  * @param options supports "desktopSharingChromeExtId"
332 334
  * @returns {string}
333 335
  */
334
-function getWebStoreInstallUrl(options)
335
-{
336
+function getWebStoreInstallUrl(options){
336 337
     return "https://chrome.google.com/webstore/detail/" +
337 338
         options.desktopSharingChromeExtId;
338 339
 }
@@ -353,10 +354,12 @@ function isUpdateRequired(minVersion, extVersion) {
353 354
             var n1 = 0,
354 355
                 n2 = 0;
355 356
 
356
-            if (i < s1.length)
357
-                {n1 = parseInt(s1[i]);}
358
-            if (i < s2.length)
359
-                {n2 = parseInt(s2[i]);}
357
+            if (i < s1.length)                {
358
+n1 = parseInt(s1[i]);
359
+}
360
+            if (i < s2.length)                {
361
+n2 = parseInt(s2[i]);
362
+}
360 363
 
361 364
             if (isNaN(n1) || isNaN(n2)) {
362 365
                 return true;
@@ -368,8 +371,7 @@ function isUpdateRequired(minVersion, extVersion) {
368 371
         // will happen if both versions have identical numbers in
369 372
         // their components (even if one of them is longer, has more components)
370 373
         return false;
371
-    }
372
-    catch (e) {
374
+    }    catch (e) {
373 375
         GlobalOnErrorHandler.callErrorHandler(e);
374 376
         logger.error("Failed to parse extension version", e);
375 377
         return true;
@@ -437,8 +439,7 @@ function doGetStreamFromExtension(options, streamCallback, failCallback) {
437 439
  * website of published extension.
438 440
  * @param options supports "desktopSharingChromeExtId"
439 441
  */
440
-function initInlineInstalls(options)
441
-{
442
+function initInlineInstalls(options){
442 443
     if($("link[rel=chrome-webstore-item]").length === 0) {
443 444
         $("head").append("<link rel=\"chrome-webstore-item\">");
444 445
     }
@@ -511,8 +512,7 @@ function onGetStreamResponse(response, onSuccess, onFailure) {
511 512
         // As noted in Chrome Desktop Capture API:
512 513
         // If user didn't select any source (i.e. canceled the prompt)
513 514
         // then the callback is called with an empty streamId.
514
-        if(response.streamId === "")
515
-        {
515
+        if(response.streamId === "")        {
516 516
             onFailure(new JitsiTrackError(
517 517
                 JitsiTrackErrors.CHROME_EXTENSION_USER_CANCELED));
518 518
             return;
@@ -533,8 +533,9 @@ function initFirefoxExtensionDetection(options) {
533 533
     if (options.desktopSharingFirefoxDisabled) {
534 534
         return;
535 535
     }
536
-    if (firefoxExtInstalled === false || firefoxExtInstalled === true)
537
-        {return;}
536
+    if (firefoxExtInstalled === false || firefoxExtInstalled === true)        {
537
+return;
538
+}
538 539
     if (!options.desktopSharingFirefoxExtId) {
539 540
         firefoxExtInstalled = false;
540 541
         return;

+ 6
- 4
modules/RTC/TraceablePeerConnection.js Vedi File

@@ -606,8 +606,9 @@ Object.keys(getters).forEach(function (prop) {
606 606
 
607 607
 TraceablePeerConnection.prototype.addStream = function (stream, ssrcInfo) {
608 608
     this.trace('addStream', stream ? stream.id : "null");
609
-    if (stream)
610
-        {this.peerconnection.addStream(stream);}
609
+    if (stream)        {
610
+this.peerconnection.addStream(stream);
611
+}
611 612
     if (ssrcInfo && ssrcInfo.type === "addMuted") {
612 613
         this.sdpConsistency.setPrimarySsrc(ssrcInfo.ssrcs[0]);
613 614
         const simGroup
@@ -912,8 +913,9 @@ TraceablePeerConnection.prototype.getStats = function(callback, errback) {
912 913
             || RTCBrowserType.isTemasysPluginUsed()
913 914
             || RTCBrowserType.isReactNative()) {
914 915
         // ignore for now...
915
-        if(!errback)
916
-            {errback = function () {};}
916
+        if(!errback)            {
917
+errback = function () {};
918
+}
917 919
         this.peerconnection.getStats(null, callback, errback);
918 920
     } else {
919 921
         this.peerconnection.getStats(callback);

+ 9
- 6
modules/TalkMutedDetection.js Vedi File

@@ -59,8 +59,9 @@ export default class TalkMutedDetection {
59 59
     _audioLevel(ssrc, audioLevel, isLocal) {
60 60
         // We are interested in the local audio stream only and if event is not
61 61
         // sent yet.
62
-        if (!isLocal || !this.audioTrack || this._eventFired)
63
-            {return;}
62
+        if (!isLocal || !this.audioTrack || this._eventFired)            {
63
+return;
64
+}
64 65
 
65 66
         if (this.audioTrack.isMuted() && audioLevel > 0.6) {
66 67
             this._eventFired = true;
@@ -91,8 +92,9 @@ export default class TalkMutedDetection {
91 92
      * @private
92 93
      */
93 94
     _trackAdded(track) {
94
-        if (this._isLocalAudioTrack(track))
95
-            {this.audioTrack = track;}
95
+        if (this._isLocalAudioTrack(track))            {
96
+this.audioTrack = track;
97
+}
96 98
     }
97 99
 
98 100
     /**
@@ -104,7 +106,8 @@ export default class TalkMutedDetection {
104 106
      * @private
105 107
      */
106 108
     _trackMuteChanged(track) {
107
-        if (this._isLocalAudioTrack(track) && track.isMuted())
108
-            {this._eventFired = false;}
109
+        if (this._isLocalAudioTrack(track) && track.isMuted())            {
110
+this._eventFired = false;
111
+}
109 112
     }
110 113
 }

+ 2
- 4
modules/connectivity/ConnectionQuality.js Vedi File

@@ -218,8 +218,7 @@ export default class ConnectionQuality {
218 218
         conference.on(
219 219
             ConferenceEvents.TRACK_ADDED,
220 220
             (track) => {
221
-                if (track.isVideoTrack() && !track.isMuted())
222
-                {
221
+                if (track.isVideoTrack() && !track.isMuted())                {
223 222
                     this._maybeUpdateUnmuteTime();
224 223
                 }
225 224
             });
@@ -318,8 +317,7 @@ export default class ConnectionQuality {
318 317
         }
319 318
 
320 319
         // Make sure that the quality doesn't climb quickly
321
-        if (this._lastConnectionQualityUpdate > 0)
322
-        {
320
+        if (this._lastConnectionQualityUpdate > 0)        {
323 321
             const maxIncreasePerSecond = 2;
324 322
             const prevConnectionQuality = this._localStats.connectionQuality;
325 323
             const diffSeconds

+ 10
- 10
modules/statistics/CallStats.js Vedi File

@@ -90,11 +90,10 @@ function initCallback (err, msg) {
90 90
                 var error = report.data;
91 91
                 CallStats._reportError.call(this, error.type, error.error,
92 92
                     error.pc);
93
-            }
94
-            // if we have and event to report and we failed to add fabric
95
-            // this event will not be reported anyway, returning an error
96
-            else if (report.type === reportType.EVENT
93
+            } else if (report.type === reportType.EVENT
97 94
                 && fabricInitialized) {
95
+                // if we have and event to report and we failed to add fabric
96
+                // this event will not be reported anyway, returning an error
98 97
                 var eventData = report.data;
99 98
                 callStats.sendFabricEvent(
100 99
                     this.peerconnection,
@@ -212,8 +211,9 @@ CallStats.feedbackEnabled = false;
212 211
  */
213 212
 CallStats._checkInitialize = function () {
214 213
     if (CallStats.initialized || !CallStats.initializeFailed
215
-        || !callStats || CallStats.initializeInProgress)
216
-        {return;}
214
+        || !callStats || CallStats.initializeInProgress)        {
215
+return;
216
+}
217 217
 
218 218
     // callstats object created, not initialized and it had previously failed,
219 219
     // and there is no init in progress, so lets try initialize it again
@@ -236,8 +236,9 @@ var reportType = {
236 236
 };
237 237
 
238 238
 CallStats.prototype.pcCallback = _try_catch(function (err, msg) {
239
-    if (callStats && err !== 'success')
240
-        {logger.error("Monitoring status: "+ err + " msg: " + msg);}
239
+    if (callStats && err !== 'success')        {
240
+logger.error("Monitoring status: "+ err + " msg: " + msg);
241
+}
241 242
 });
242 243
 
243 244
 /**
@@ -278,8 +279,7 @@ function (ssrc, isLocal, usageLabel, containerId) {
278 279
                 ssrc,
279 280
                 usageLabel,
280 281
                 containerId);
281
-        }
282
-        else {
282
+        }        else {
283 283
             CallStats.reportsQueue.push({
284 284
                 type: reportType.MST_WITH_USERID,
285 285
                 data: {

+ 8
- 8
modules/statistics/LocalStatsCollector.js Vedi File

@@ -46,8 +46,9 @@ function timeDomainDataToAudioLevel(samples) {
46 46
     var length = samples.length;
47 47
 
48 48
     for (var i = 0; i < length; i++) {
49
-        if (maxVolume < samples[i])
50
-            {maxVolume = samples[i];}
49
+        if (maxVolume < samples[i])            {
50
+maxVolume = samples[i];
51
+}
51 52
     }
52 53
 
53 54
     return parseFloat(((maxVolume - 127) / 128).toFixed(3));
@@ -64,11 +65,9 @@ function animateLevel(newLevel, lastLevel) {
64 65
     var diff = lastLevel - newLevel;
65 66
     if(diff > 0.2) {
66 67
         value = lastLevel - 0.2;
67
-    }
68
-    else if(diff < -0.4) {
68
+    }    else if(diff < -0.4) {
69 69
         value = lastLevel + 0.4;
70
-    }
71
-    else {
70
+    }    else {
72 71
         value = newLevel;
73 72
     }
74 73
 
@@ -97,8 +96,9 @@ function LocalStatsCollector(stream, interval, callback) {
97 96
  */
98 97
 LocalStatsCollector.prototype.start = function () {
99 98
     if (!context ||
100
-        RTCBrowserType.isTemasysPluginUsed())
101
-        {return;}
99
+        RTCBrowserType.isTemasysPluginUsed())        {
100
+return;
101
+}
102 102
     context.resume();
103 103
     var analyser = context.createAnalyser();
104 104
     analyser.smoothingTimeConstant = WEBAUDIO_ANALYZER_SMOOTING_TIME;

+ 45
- 40
modules/statistics/RTPStatsCollector.js Vedi File

@@ -64,8 +64,9 @@ KEYS_BY_BROWSER_TYPE[RTCBrowserType.RTC_BROWSER_REACT_NATIVE] =
64 64
  * @returns {number} packet loss percent
65 65
  */
66 66
 function calculatePacketLoss(lostPackets, totalPackets) {
67
-    if(!totalPackets || totalPackets <= 0 || !lostPackets || lostPackets <= 0)
68
-        {return 0;}
67
+    if(!totalPackets || totalPackets <= 0 || !lostPackets || lostPackets <= 0)        {
68
+return 0;
69
+}
69 70
     return Math.round((lostPackets/totalPackets)*100);
70 71
 }
71 72
 
@@ -179,8 +180,9 @@ function StatsCollector(
179 180
      */
180 181
     this._browserType = RTCBrowserType.getBrowserType();
181 182
     var keys = KEYS_BY_BROWSER_TYPE[this._browserType];
182
-    if (!keys)
183
-        {throw "The browser type '" + this._browserType + "' isn't supported!";}
183
+    if (!keys)        {
184
+throw "The browser type '" + this._browserType + "' isn't supported!";
185
+}
184 186
     /**
185 187
      * The function which is to be used to retrieve the value associated in a
186 188
      * report returned by RTCPeerConnection#getStats with a LibJitsiMeet
@@ -250,8 +252,7 @@ StatsCollector.prototype.start = function (startAudioLevelStats) {
250 252
                         if (!report || !report.result ||
251 253
                             typeof report.result != 'function') {
252 254
                             results = report;
253
-                        }
254
-                        else {
255
+                        }                        else {
255 256
                             results = report.result();
256 257
                         }
257 258
                         self.currentAudioLevelsReport = results;
@@ -277,16 +278,14 @@ StatsCollector.prototype.start = function (startAudioLevelStats) {
277 278
                             typeof report.result != 'function') {
278 279
                             //firefox
279 280
                             results = report;
280
-                        }
281
-                        else {
281
+                        }                        else {
282 282
                             //chrome
283 283
                             results = report.result();
284 284
                         }
285 285
                         self.currentStatsReport = results;
286 286
                         try {
287 287
                             self.processStatsReport();
288
-                        }
289
-                        catch (e) {
288
+                        }                        catch (e) {
290 289
                             GlobalOnErrorHandler.callErrorHandler(e);
291 290
                             logger.error("Unsupported key:" + e, e);
292 291
                         }
@@ -315,10 +314,11 @@ StatsCollector.prototype._defineGetStatValueMethod = function (keys) {
315 314
     // RTCPeerConnection#getStats.
316 315
     var keyFromName = function (name) {
317 316
         var key = keys[name];
318
-        if (key)
319
-            {return key;}
320
-        else
321
-            {throw "The property '" + name + "' isn't supported!";}
317
+        if (key)            {
318
+return key;
319
+}        else            {
320
+throw "The property '" + name + "' isn't supported!";
321
+}
322 322
     };
323 323
 
324 324
     // Define the function which retrieves the value from a specific report
@@ -337,7 +337,9 @@ StatsCollector.prototype._defineGetStatValueMethod = function (keys) {
337 337
         // example, if item has a stat property of type function, then it's very
338 338
         // likely that whoever defined it wanted you to call it in order to
339 339
         // retrieve the value associated with a specific key.
340
-        itemStatByKey = function (item, key) { return item.stat(key); };
340
+        itemStatByKey = function (item, key) {
341
+ return item.stat(key); 
342
+};
341 343
         break;
342 344
     case RTCBrowserType.RTC_BROWSER_REACT_NATIVE:
343 345
         // The implementation provided by react-native-webrtc follows the
@@ -357,7 +359,9 @@ StatsCollector.prototype._defineGetStatValueMethod = function (keys) {
357 359
         };
358 360
         break;
359 361
     default:
360
-        itemStatByKey = function (item, key) { return item[key]; };
362
+        itemStatByKey = function (item, key) {
363
+ return item[key]; 
364
+};
361 365
     }
362 366
 
363 367
     // Compose the 2 functions defined above to get a function which retrieves
@@ -402,26 +406,26 @@ StatsCollector.prototype.processStatsReport = function () {
402 406
                     "upload": Math.round(sendBandwidth / 1000)
403 407
                 };
404 408
             }
405
-        }
406
-        catch(e){/*not supported*/}
409
+        }        catch(e){/*not supported*/}
407 410
 
408
-        if(now.type == 'googCandidatePair')
409
-        {
411
+        if(now.type == 'googCandidatePair')        {
410 412
             var ip, type, localip, active;
411 413
             try {
412 414
                 ip = getStatValue(now, 'remoteAddress');
413 415
                 type = getStatValue(now, "transportType");
414 416
                 localip = getStatValue(now, "localAddress");
415 417
                 active = getStatValue(now, "activeConnection");
416
-            }
417
-            catch(e){/*not supported*/}
418
-            if(!ip || !type || !localip || active != "true")
419
-                {continue;}
418
+            }            catch(e){/*not supported*/}
419
+            if(!ip || !type || !localip || active != "true")                {
420
+continue;
421
+}
420 422
             // Save the address unless it has been saved already.
421 423
             var conferenceStatsTransport = this.conferenceStats.transport;
422
-            if(!conferenceStatsTransport.some(function (t) { return (
424
+            if(!conferenceStatsTransport.some(function (t) {
425
+ return (
423 426
                         t.ip == ip && t.type == type && t.localip == localip
424
-                    );})) {
427
+                    );
428
+})) {
425 429
                 conferenceStatsTransport.push(
426 430
                     {ip: ip, type: type, localip: localip});
427 431
             }
@@ -429,8 +433,9 @@ StatsCollector.prototype.processStatsReport = function () {
429 433
         }
430 434
 
431 435
         if(now.type == "candidatepair") {
432
-            if(now.state == "succeeded")
433
-                {continue;}
436
+            if(now.state == "succeeded")                {
437
+continue;
438
+}
434 439
 
435 440
             var local = this.currentStatsReport[now.localCandidateId];
436 441
             var remote = this.currentStatsReport[now.remoteCandidateId];
@@ -468,8 +473,9 @@ StatsCollector.prototype.processStatsReport = function () {
468 473
                 continue;
469 474
             }
470 475
         }
471
-        if (!packetsNow || packetsNow < 0)
472
-            {packetsNow = 0;}
476
+        if (!packetsNow || packetsNow < 0)            {
477
+packetsNow = 0;
478
+}
473 479
 
474 480
         var packetsBefore = getNonNegativeStat(before, key);
475 481
         var packetsDiff = Math.max(0, packetsNow - packetsBefore);
@@ -525,14 +531,12 @@ StatsCollector.prototype.processStatsReport = function () {
525 531
                 (width = getStatValue(now, "googFrameWidthReceived"))) {
526 532
                 resolution.height = height;
527 533
                 resolution.width = width;
528
-            }
529
-            else if ((height = getStatValue(now, "googFrameHeightSent")) &&
534
+            }            else if ((height = getStatValue(now, "googFrameHeightSent")) &&
530 535
                 (width = getStatValue(now, "googFrameWidthSent"))) {
531 536
                 resolution.height = height;
532 537
                 resolution.width = width;
533 538
             }
534
-        }
535
-        catch(e){/*not supported*/}
539
+        }        catch(e){/*not supported*/}
536 540
 
537 541
         if (resolution.height && resolution.width) {
538 542
             ssrcStats.setResolution(resolution);
@@ -611,8 +615,9 @@ StatsCollector.prototype.processAudioLevelReport = function () {
611 615
     for (var idx in this.currentAudioLevelsReport) {
612 616
         var now = this.currentAudioLevelsReport[idx];
613 617
 
614
-        if (now.type != 'ssrc')
615
-            {continue;}
618
+        if (now.type != 'ssrc')            {
619
+continue;
620
+}
616 621
 
617 622
         var before = this.baselineAudioLevelsReport[idx];
618 623
         var ssrc = getStatValue(now, 'ssrc');
@@ -622,8 +627,9 @@ StatsCollector.prototype.processAudioLevelReport = function () {
622 627
         }
623 628
 
624 629
         if (!ssrc) {
625
-            if ((Date.now() - now.timestamp) < 3000)
626
-                {logger.warn("No ssrc: ");}
630
+            if ((Date.now() - now.timestamp) < 3000)                {
631
+logger.warn("No ssrc: ");
632
+}
627 633
             continue;
628 634
         }
629 635
 
@@ -632,8 +638,7 @@ StatsCollector.prototype.processAudioLevelReport = function () {
632 638
             var audioLevel
633 639
                 = getStatValue(now, 'audioInputLevel')
634 640
                     || getStatValue(now, 'audioOutputLevel');
635
-        }
636
-        catch(e) {/*not supported*/
641
+        }        catch(e) {/*not supported*/
637 642
             logger.warn("Audio Levels are not available in the statistics.");
638 643
             clearInterval(this.audioLevelsIntervalId);
639 644
             return;

+ 55
- 37
modules/statistics/statistics.js Vedi File

@@ -89,8 +89,9 @@ function Statistics(xmpp, options) {
89 89
             // of callstats.io may be disabled because of globally-disallowed
90 90
             // requests to any third parties.
91 91
             && (Statistics.disableThirdPartyRequests !== true);
92
-    if(this.callStatsIntegrationEnabled)
93
-        {loadCallStatsAPI(this.options.callStatsCustomScriptUrl);}
92
+    if(this.callStatsIntegrationEnabled)        {
93
+loadCallStatsAPI(this.options.callStatsCustomScriptUrl);
94
+}
94 95
     this.callStats = null;
95 96
     // Flag indicates whether or not the CallStats have been started for this
96 97
     // Statistics instance
@@ -124,8 +125,9 @@ Statistics.prototype.startRemoteStats = function (peerconnection) {
124 125
 Statistics.localStats = [];
125 126
 
126 127
 Statistics.startLocalStats = function (stream, callback) {
127
-    if(!Statistics.audioLevelsEnabled)
128
-        {return;}
128
+    if(!Statistics.audioLevelsEnabled)        {
129
+return;
130
+}
129 131
     var localStats = new LocalStats(stream, Statistics.audioLevelsInterval,
130 132
         callback);
131 133
     this.localStats.push(localStats);
@@ -133,14 +135,16 @@ Statistics.startLocalStats = function (stream, callback) {
133 135
 };
134 136
 
135 137
 Statistics.prototype.addAudioLevelListener = function(listener) {
136
-    if(!Statistics.audioLevelsEnabled)
137
-        {return;}
138
+    if(!Statistics.audioLevelsEnabled)        {
139
+return;
140
+}
138 141
     this.eventEmitter.on(StatisticsEvents.AUDIO_LEVEL, listener);
139 142
 };
140 143
 
141 144
 Statistics.prototype.removeAudioLevelListener = function(listener) {
142
-    if(!Statistics.audioLevelsEnabled)
143
-        {return;}
145
+    if(!Statistics.audioLevelsEnabled)        {
146
+return;
147
+}
144 148
     this.eventEmitter.removeListener(StatisticsEvents.AUDIO_LEVEL, listener);
145 149
 };
146 150
 
@@ -176,20 +180,23 @@ Statistics.prototype.dispose = function () {
176 180
     }
177 181
     this.stopCallStats();
178 182
     this.stopRemoteStats();
179
-    if(this.eventEmitter)
180
-        {this.eventEmitter.removeAllListeners();}
183
+    if(this.eventEmitter)        {
184
+this.eventEmitter.removeAllListeners();
185
+}
181 186
 };
182 187
 
183 188
 Statistics.stopLocalStats = function (stream) {
184
-    if(!Statistics.audioLevelsEnabled)
185
-        {return;}
189
+    if(!Statistics.audioLevelsEnabled)        {
190
+return;
191
+}
186 192
 
187
-    for(var i = 0; i < Statistics.localStats.length; i++)
188
-        {if(Statistics.localStats[i].stream === stream){
193
+    for(var i = 0; i < Statistics.localStats.length; i++)        {
194
+if(Statistics.localStats[i].stream === stream){
189 195
             var localStats = Statistics.localStats.splice(i, 1);
190 196
             localStats[0].stop();
191 197
             break;
192
-        }}
198
+        }
199
+}
193 200
 };
194 201
 
195 202
 Statistics.prototype.stopRemoteStats = function () {
@@ -223,8 +230,9 @@ Statistics.prototype.startCallStats = function (session) {
223 230
 Statistics.prototype.stopCallStats = function () {
224 231
     if(this.callStatsStarted) {
225 232
         var index = Statistics.callsStatsInstances.indexOf(this.callstats);
226
-        if(index > -1)
227
-            {Statistics.callsStatsInstances.splice(index, 1);}
233
+        if(index > -1)            {
234
+Statistics.callsStatsInstances.splice(index, 1);
235
+}
228 236
         // The next line is commented because we need to be able to send
229 237
         // feedback even after the conference has been destroyed.
230 238
         // this.callstats = null;
@@ -249,8 +257,9 @@ Statistics.prototype.isCallstatsEnabled = function () {
249 257
  * @param {RTCPeerConnection} pc connection on which failure occured.
250 258
  */
251 259
 Statistics.prototype.sendIceConnectionFailedEvent = function (pc) {
252
-    if(this.callstats)
253
-        {this.callstats.sendIceConnectionFailedEvent(pc, this.callstats);}
260
+    if(this.callstats)        {
261
+this.callstats.sendIceConnectionFailedEvent(pc, this.callstats);
262
+}
254 263
     Statistics.analytics.sendEvent('connection.ice_failed');
255 264
 };
256 265
 
@@ -260,8 +269,9 @@ Statistics.prototype.sendIceConnectionFailedEvent = function (pc) {
260 269
  * @param type {String} "audio"/"video"
261 270
  */
262 271
 Statistics.prototype.sendMuteEvent = function (muted, type) {
263
-    if(this.callstats)
264
-        {CallStats.sendMuteEvent(muted, type, this.callstats);}
272
+    if(this.callstats)        {
273
+CallStats.sendMuteEvent(muted, type, this.callstats);
274
+}
265 275
 };
266 276
 
267 277
 /**
@@ -270,8 +280,9 @@ Statistics.prototype.sendMuteEvent = function (muted, type) {
270 280
  * false for not stopping
271 281
  */
272 282
 Statistics.prototype.sendScreenSharingEvent = function (start) {
273
-    if(this.callstats)
274
-        {CallStats.sendScreenSharingEvent(start, this.callstats);}
283
+    if(this.callstats)        {
284
+CallStats.sendScreenSharingEvent(start, this.callstats);
285
+}
275 286
 };
276 287
 
277 288
 /**
@@ -279,8 +290,9 @@ Statistics.prototype.sendScreenSharingEvent = function (start) {
279 290
  * conference.
280 291
  */
281 292
 Statistics.prototype.sendDominantSpeakerEvent = function () {
282
-    if(this.callstats)
283
-        {CallStats.sendDominantSpeakerEvent(this.callstats);}
293
+    if(this.callstats)        {
294
+CallStats.sendDominantSpeakerEvent(this.callstats);
295
+}
284 296
 };
285 297
 
286 298
 /**
@@ -348,8 +360,9 @@ Statistics.sendGetUserMediaFailed = function (e) {
348 360
  * @param {RTCPeerConnection} pc connection on which failure occured.
349 361
  */
350 362
 Statistics.prototype.sendCreateOfferFailed = function (e, pc) {
351
-    if(this.callstats)
352
-        {CallStats.sendCreateOfferFailed(e, pc, this.callstats);}
363
+    if(this.callstats)        {
364
+CallStats.sendCreateOfferFailed(e, pc, this.callstats);
365
+}
353 366
 };
354 367
 
355 368
 /**
@@ -359,8 +372,9 @@ Statistics.prototype.sendCreateOfferFailed = function (e, pc) {
359 372
  * @param {RTCPeerConnection} pc connection on which failure occured.
360 373
  */
361 374
 Statistics.prototype.sendCreateAnswerFailed = function (e, pc) {
362
-    if(this.callstats)
363
-        {CallStats.sendCreateAnswerFailed(e, pc, this.callstats);}
375
+    if(this.callstats)        {
376
+CallStats.sendCreateAnswerFailed(e, pc, this.callstats);
377
+}
364 378
 };
365 379
 
366 380
 /**
@@ -370,8 +384,9 @@ Statistics.prototype.sendCreateAnswerFailed = function (e, pc) {
370 384
  * @param {RTCPeerConnection} pc connection on which failure occured.
371 385
  */
372 386
 Statistics.prototype.sendSetLocalDescFailed = function (e, pc) {
373
-    if(this.callstats)
374
-        {CallStats.sendSetLocalDescFailed(e, pc, this.callstats);}
387
+    if(this.callstats)        {
388
+CallStats.sendSetLocalDescFailed(e, pc, this.callstats);
389
+}
375 390
 };
376 391
 
377 392
 /**
@@ -381,8 +396,9 @@ Statistics.prototype.sendSetLocalDescFailed = function (e, pc) {
381 396
  * @param {RTCPeerConnection} pc connection on which failure occured.
382 397
  */
383 398
 Statistics.prototype.sendSetRemoteDescFailed = function (e, pc) {
384
-    if(this.callstats)
385
-        {CallStats.sendSetRemoteDescFailed(e, pc, this.callstats);}
399
+    if(this.callstats)        {
400
+CallStats.sendSetRemoteDescFailed(e, pc, this.callstats);
401
+}
386 402
 };
387 403
 
388 404
 /**
@@ -392,8 +408,9 @@ Statistics.prototype.sendSetRemoteDescFailed = function (e, pc) {
392 408
  * @param {RTCPeerConnection} pc connection on which failure occured.
393 409
  */
394 410
 Statistics.prototype.sendAddIceCandidateFailed = function (e, pc) {
395
-    if(this.callstats)
396
-        {CallStats.sendAddIceCandidateFailed(e, pc, this.callstats);}
411
+    if(this.callstats)        {
412
+CallStats.sendAddIceCandidateFailed(e, pc, this.callstats);
413
+}
397 414
 };
398 415
 
399 416
 /**
@@ -418,8 +435,9 @@ Statistics.sendLog = function (m) {
418 435
  * @param detailed detailed feedback from the user. Not yet used
419 436
  */
420 437
 Statistics.prototype.sendFeedback = function(overall, detailed) {
421
-    if(this.callstats)
422
-        {this.callstats.sendFeedback(overall, detailed);}
438
+    if(this.callstats)        {
439
+this.callstats.sendFeedback(overall, detailed);
440
+}
423 441
     Statistics.analytics.sendEvent("feedback.rating",
424 442
         {value: overall, detailed: detailed});
425 443
 };

+ 6
- 12
modules/transcription/audioRecorder.js Vedi File

@@ -91,11 +91,9 @@ function instantiateTrackRecorder(track) {
91 91
 function determineCorrectFileType() {
92 92
     if(MediaRecorder.isTypeSupported(AUDIO_WEBM)) {
93 93
         return AUDIO_WEBM;
94
-    }
95
-    else if(MediaRecorder.isTypeSupported(AUDIO_OGG)) {
94
+    }    else if(MediaRecorder.isTypeSupported(AUDIO_OGG)) {
96 95
         return AUDIO_OGG;
97
-    }
98
-    else {
96
+    }    else {
99 97
         throw new Error("unable to create a MediaRecorder with the" +
100 98
             "right mimetype!");
101 99
     }
@@ -169,8 +167,7 @@ audioRecorder.prototype.removeTrack = function(track){
169 167
             var recorderToRemove = array[i];
170 168
             if(this.isRecording){
171 169
                 stopRecorder(recorderToRemove);
172
-            }
173
-            else {
170
+            }            else {
174 171
                 //remove the TrackRecorder from the array
175 172
                 array.splice(i, 1);
176 173
             }
@@ -191,8 +188,7 @@ audioRecorder.prototype.updateNames = function(){
191 188
     this.recorders.forEach(function(trackRecorder){
192 189
         if(trackRecorder.track.isLocal()){
193 190
             trackRecorder.name = "the transcriber";
194
-        }
195
-        else {
191
+        }        else {
196 192
             var id = trackRecorder.track.getParticipantId();
197 193
             var participant = conference.getParticipantById(id);
198 194
             var newName = participant.getDisplayName();
@@ -296,11 +292,9 @@ function createEmptyStream() {
296 292
     // Firefox supports the MediaStream object, Chrome webkitMediaStream
297 293
     if(typeof MediaStream !== 'undefined') {
298 294
         return new MediaStream();
299
-    }
300
-    else if(typeof webkitMediaStream !== 'undefined') {
295
+    }    else if(typeof webkitMediaStream !== 'undefined') {
301 296
         return new webkitMediaStream(); // eslint-disable-line new-cap
302
-    }
303
-    else {
297
+    }    else {
304 298
         throw new Error("cannot create a clean mediaStream");
305 299
     }
306 300
 }

+ 1
- 2
modules/transcription/transcriber.js Vedi File

@@ -255,8 +255,7 @@ var hasPopulatedArrays = function(twoDimensionalArray){
255 255
 var pushWordToSortedArray = function(array, word){
256 256
     if(array.length === 0) {
257 257
         array.push(word);
258
-    }
259
-    else{
258
+    }    else{
260 259
         if(array[array.length - 1].begin <= word.begin){
261 260
             array.push(word);
262 261
             return;

+ 1
- 2
modules/transcription/transcriptionServices/AbstractTranscriptionService.js Vedi File

@@ -24,8 +24,7 @@ TranscriptionService.prototype.send = function send(recordingResult, callback){
24 24
                    " is not valid!");
25 25
             recordingResult.wordArray = [];
26 26
             callback(recordingResult);
27
-        }
28
-        else{
27
+        }        else{
29 28
             recordingResult.wordArray = t.formatResponse(response);
30 29
             callback(recordingResult);
31 30
         }

+ 6
- 10
modules/transcription/transcriptionServices/SphinxTranscriptionService.js Vedi File

@@ -34,11 +34,10 @@ SphinxService.prototype.sendRequest = function(audioFileBlob, callback) {
34 34
     console.log("the audio file being sent: " + audioFileBlob);
35 35
     var request = new XMLHttpRequest();
36 36
     request.onreadystatechange = function() {
37
-        if(request.readyState === XMLHttpRequest.DONE && request.status === 200)
38
-        {
37
+        if(request.readyState === XMLHttpRequest.DONE
38
+            && request.status === 200) {
39 39
             callback(request.responseText);
40
-        }
41
-        else if (request.readyState === XMLHttpRequest.DONE) {
40
+        } else if (request.readyState === XMLHttpRequest.DONE) {
42 41
             throw new Error("unable to accept response from sphinx server." +
43 42
                 "status: " + request.status);
44 43
         }
@@ -86,8 +85,7 @@ SphinxService.prototype.verify = function(response){
86 85
     var json;
87 86
     try{
88 87
         json = JSON.parse(response);
89
-    }
90
-    catch (error){
88
+    }    catch (error){
91 89
         console.log(error);
92 90
         return false;
93 91
     }
@@ -115,13 +113,11 @@ function getURL() {
115 113
     "Sphinx4 https server";
116 114
     if(config.sphinxURL === undefined){
117 115
         console.log(message);
118
-    }
119
-    else {
116
+    }    else {
120 117
         var toReturn = config.sphinxURL;
121 118
         if(toReturn.includes !== undefined && toReturn.includes("https://")){
122 119
             return toReturn;
123
-        }
124
-        else{
120
+        }        else{
125 121
             console.log(message);
126 122
         }
127 123
     }

+ 3
- 2
modules/util/EventEmitterForwarder.js Vedi File

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

+ 12
- 8
modules/util/GlobalOnErrorHandler.js Vedi File

@@ -22,8 +22,9 @@ function JitsiGlobalErrorHandler(message, source, lineno, colno, error) {
22 22
     handlers.forEach(function (handler) {
23 23
         handler(message, source, lineno, colno, error);
24 24
     });
25
-    if (oldOnErrorHandler)
26
-        {oldOnErrorHandler(message, source, lineno, colno, error);}
25
+    if (oldOnErrorHandler)        {
26
+oldOnErrorHandler(message, source, lineno, colno, error);
27
+}
27 28
 }
28 29
 
29 30
 // If an old handler exists, also fire its events.
@@ -37,8 +38,9 @@ function JitsiGlobalUnhandledRejection(event) {
37 38
     handlers.forEach(function (handler) {
38 39
         handler(null, null, null, null, event.reason);
39 40
     });
40
-    if(oldOnUnhandledRejection)
41
-        {oldOnUnhandledRejection(event);}
41
+    if(oldOnUnhandledRejection)        {
42
+oldOnUnhandledRejection(event);
43
+}
42 44
 }
43 45
 
44 46
 // Setting the custom error handlers.
@@ -60,8 +62,9 @@ var GlobalOnErrorHandler = {
60 62
      */
61 63
     callErrorHandler: function (error) {
62 64
         var errHandler = window.onerror;
63
-        if(!errHandler)
64
-            {return;}
65
+        if(!errHandler)            {
66
+return;
67
+}
65 68
         errHandler(null, null, null, null, error);
66 69
     },
67 70
     /**
@@ -70,8 +73,9 @@ var GlobalOnErrorHandler = {
70 73
      */
71 74
     callUnhandledRejectionHandler: function (error) {
72 75
         var errHandler = window.onunhandledrejection;
73
-        if(!errHandler)
74
-            {return;}
76
+        if(!errHandler)            {
77
+return;
78
+}
75 79
         errHandler(error);
76 80
     }
77 81
 };

+ 9
- 6
modules/util/ScriptUtil.js Vedi File

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

+ 3
- 2
modules/version/ComponentsVersions.js Vedi File

@@ -74,8 +74,9 @@ ComponentsVersions.prototype.processPresence =
74 74
     }.bind(this));
75 75
 
76 76
     // logs versions to stats
77
-    if (log.length > 0)
78
-        {Statistics.sendLog(JSON.stringify(log));}
77
+    if (log.length > 0)        {
78
+Statistics.sendLog(JSON.stringify(log));
79
+}
79 80
 };
80 81
 
81 82
 /**

+ 1
- 2
modules/xmpp/Caps.js Vedi File

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

+ 61
- 48
modules/xmpp/ChatRoom.js Vedi File

@@ -37,10 +37,12 @@ var parser = {
37 37
                 continue;
38 38
             }
39 39
             packet.c(node.tagName, node.attributes);
40
-            if(node.value)
41
-                {packet.t(node.value);}
42
-            if(node.children)
43
-                {this.json2packet(node.children, packet);}
40
+            if(node.value)                {
41
+packet.t(node.value);
42
+}
43
+            if(node.children)                {
44
+this.json2packet(node.children, packet);
45
+}
44 46
             packet.up();
45 47
         }
46 48
         // packet.up();
@@ -54,9 +56,11 @@ var parser = {
54 56
  */
55 57
 function filterNodeFromPresenceJSON(pres, nodeName){
56 58
     var res = [];
57
-    for(let i = 0; i < pres.length; i++)
58
-        {if(pres[i].tagName === nodeName)
59
-            {res.push(pres[i]);}}
59
+    for(let i = 0; i < pres.length; i++)        {
60
+if(pres[i].tagName === nodeName)            {
61
+res.push(pres[i]);
62
+}
63
+}
60 64
 
61 65
     return res;
62 66
 }
@@ -275,11 +279,9 @@ export default class ChatRoom extends Listenable {
275 279
         let jibri = null;
276 280
         // process nodes to extract data needed for MUC_JOINED and MUC_MEMBER_JOINED
277 281
         // events
278
-        for(let i = 0; i < nodes.length; i++)
279
-        {
282
+        for(let i = 0; i < nodes.length; i++)        {
280 283
             const node = nodes[i];
281
-            switch(node.tagName)
282
-            {
284
+            switch(node.tagName)            {
283 285
                 case "nick":
284 286
                     member.nick = node.value;
285 287
                     break;
@@ -302,8 +304,9 @@ export default class ChatRoom extends Listenable {
302 304
                 logger.log("(TIME) MUC joined:\t", now);
303 305
 
304 306
                 // set correct initial state of locked
305
-                if (this.password)
306
-                    {this.locked = true;}
307
+                if (this.password)                    {
308
+this.locked = true;
309
+}
307 310
 
308 311
                 this.eventEmitter.emit(XMPPEvents.MUC_JOINED);
309 312
             }
@@ -342,17 +345,16 @@ export default class ChatRoom extends Listenable {
342 345
             }
343 346
 
344 347
             // store the new display name
345
-            if(member.displayName)
346
-                {memberOfThis.displayName = member.displayName;}
348
+            if(member.displayName)                {
349
+memberOfThis.displayName = member.displayName;
350
+}
347 351
         }
348 352
 
349 353
         // after we had fired member or room joined events, lets fire events
350 354
         // for the rest info we got in presence
351
-        for(let i = 0; i < nodes.length; i++)
352
-        {
355
+        for(let i = 0; i < nodes.length; i++)        {
353 356
             const node = nodes[i];
354
-            switch(node.tagName)
355
-            {
357
+            switch(node.tagName)            {
356 358
                 case "nick":
357 359
                     if(!member.isFocus) {
358 360
                         var displayName = this.xmpp.options.displayJids
@@ -375,8 +377,9 @@ export default class ChatRoom extends Listenable {
375 377
                     break;
376 378
                 case "call-control":
377 379
                     var att = node.attributes;
378
-                    if(!att)
379
-                        {break;}
380
+                    if(!att)                        {
381
+break;
382
+}
380 383
                     this.phoneNumber = att.phone || null;
381 384
                     this.phonePin = att.pin || null;
382 385
                     this.eventEmitter.emit(XMPPEvents.PHONE_NUMBER_CHANGED);
@@ -391,11 +394,11 @@ export default class ChatRoom extends Listenable {
391 394
             this.eventEmitter.emit(XMPPEvents.PRESENCE_STATUS, from, member.status);
392 395
         }
393 396
 
394
-        if(jibri)
395
-        {
397
+        if(jibri)        {
396 398
             this.lastJibri = jibri;
397
-            if(this.recording)
398
-                {this.recording.handleJibriPresence(jibri);}
399
+            if(this.recording)                {
400
+this.recording.handleJibriPresence(jibri);
401
+}
399 402
         }
400 403
     }
401 404
 
@@ -410,8 +413,9 @@ export default class ChatRoom extends Listenable {
410 413
             this.recording = new Recorder(this.options.recordingType,
411 414
                 this.eventEmitter, this.connection, this.focusMucJid,
412 415
                 this.options.jirecon, this.roomjid);
413
-            if(this.lastJibri)
414
-                {this.recording.handleJibriPresence(this.lastJibri);}
416
+            if(this.lastJibri)                {
417
+this.recording.handleJibriPresence(this.lastJibri);
418
+}
415 419
         }
416 420
         logger.info("Ignore focus: " + from + ", real JID: " + mucJid);
417 421
     }
@@ -468,8 +472,9 @@ export default class ChatRoom extends Listenable {
468 472
 
469 473
         delete this.lastPresences[jid];
470 474
 
471
-        if(skipEvents)
472
-            {return;}
475
+        if(skipEvents)            {
476
+return;
477
+}
473 478
 
474 479
         this.eventEmitter.emit(XMPPEvents.MUC_MEMBER_LEFT, jid);
475 480
 
@@ -506,10 +511,10 @@ export default class ChatRoom extends Listenable {
506 511
         if (!isSelfPresence) {
507 512
             delete this.members[from];
508 513
             this.onParticipantLeft(from, false);
509
-        }
510
-        // If the status code is 110 this means we're leaving and we would like
511
-        // to remove everyone else from our view, so we trigger the event.
512
-        else if (Object.keys(this.members).length > 0) {
514
+        } else if (Object.keys(this.members).length > 0) {
515
+            // If the status code is 110 this means we're leaving and we would
516
+            // like to remove everyone else from our view, so we trigger the
517
+            // event.
513 518
             for (const i in this.members) {
514 519
                 const member = this.members[i];
515 520
                 delete this.members[i];
@@ -519,8 +524,9 @@ export default class ChatRoom extends Listenable {
519 524
 
520 525
             // we fire muc_left only if this is not a kick,
521 526
             // kick has both statuses 110 and 307.
522
-            if (!isKick)
523
-                {this.eventEmitter.emit(XMPPEvents.MUC_LEFT);}
527
+            if (!isKick)                {
528
+this.eventEmitter.emit(XMPPEvents.MUC_LEFT);
529
+}
524 530
         }
525 531
 
526 532
         if (isKick && this.myroomjid === from) {
@@ -651,7 +657,8 @@ export default class ChatRoom extends Listenable {
651 657
 
652 658
     removeFromPresence (key) {
653 659
         var nodes = this.presMap.nodes.filter(function(node) {
654
-            return key !== node.tagName;});
660
+            return key !== node.tagName;
661
+});
655 662
         this.presMap.nodes = nodes;
656 663
     }
657 664
 
@@ -693,8 +700,9 @@ export default class ChatRoom extends Listenable {
693 700
 
694 701
     setVideoMute (mute, callback) {
695 702
         this.sendVideoInfoPresence(mute);
696
-        if(callback)
697
-            {callback(mute);}
703
+        if(callback)            {
704
+callback(mute);
705
+}
698 706
     }
699 707
 
700 708
     setAudioMute (mute, callback) {
@@ -714,8 +722,9 @@ export default class ChatRoom extends Listenable {
714 722
         if(this.connection) {
715 723
             this.sendPresence();
716 724
         }
717
-        if(callback)
718
-            {callback();}
725
+        if(callback)            {
726
+callback();
727
+}
719 728
     }
720 729
 
721 730
     addVideoInfoToPresence (mute) {
@@ -728,8 +737,9 @@ export default class ChatRoom extends Listenable {
728 737
 
729 738
     sendVideoInfoPresence (mute) {
730 739
         this.addVideoInfoToPresence(mute);
731
-        if(!this.connection)
732
-            {return;}
740
+        if(!this.connection)            {
741
+return;
742
+}
733 743
         this.sendPresence();
734 744
     }
735 745
 
@@ -780,8 +790,9 @@ export default class ChatRoom extends Listenable {
780 790
      * Returns true if the recording is supproted and false if not.
781 791
      */
782 792
     isRecordingSupported () {
783
-        if(this.recording)
784
-            {return this.recording.isSupported();}
793
+        if(this.recording)            {
794
+return this.recording.isSupported();
795
+}
785 796
         return false;
786 797
     }
787 798
 
@@ -806,8 +817,9 @@ export default class ChatRoom extends Listenable {
806 817
      * @param statusChangeHandler {function} receives the new status as argument.
807 818
      */
808 819
     toggleRecording (options, statusChangeHandler) {
809
-        if(this.recording)
810
-            {return this.recording.toggleRecording(options, statusChangeHandler);}
820
+        if(this.recording)            {
821
+return this.recording.toggleRecording(options, statusChangeHandler);
822
+}
811 823
 
812 824
         return statusChangeHandler("error",
813 825
             new Error("The conference is not created yet!"));
@@ -817,8 +829,9 @@ export default class ChatRoom extends Listenable {
817 829
      * Returns true if the SIP calls are supported and false otherwise
818 830
      */
819 831
     isSIPCallingSupported () {
820
-        if(this.moderator)
821
-            {return this.moderator.isSipGatewayEnabled();}
832
+        if(this.moderator)            {
833
+return this.moderator.isSipGatewayEnabled();
834
+}
822 835
         return false;
823 836
     }
824 837
 

+ 54
- 31
modules/xmpp/JingleSessionPC.js Vedi File

@@ -130,11 +130,13 @@ export default class JingleSessionPC extends JingleSession {
130 130
                 if (typeof protocol === 'string') {
131 131
                     protocol = protocol.toLowerCase();
132 132
                     if (protocol === 'tcp' || protocol === 'ssltcp') {
133
-                        if (this.webrtcIceTcpDisable)
134
-                            {return;}
133
+                        if (this.webrtcIceTcpDisable)                            {
134
+return;
135
+}
135 136
                     } else if (protocol == 'udp') {
136
-                        if (this.webrtcIceUdpDisable)
137
-                            {return;}
137
+                        if (this.webrtcIceUdpDisable)                            {
138
+return;
139
+}
138 140
                     }
139 141
                 }
140 142
             }
@@ -148,7 +150,9 @@ export default class JingleSessionPC extends JingleSession {
148 150
         // "closed" instead.
149 151
         // I suppose at some point this will be moved to onconnectionstatechange
150 152
         this.peerconnection.onsignalingstatechange = () => {
151
-            if (!this.peerconnection) {return;}
153
+            if (!this.peerconnection) {
154
+return;
155
+}
152 156
             if (this.peerconnection.signalingState === 'stable') {
153 157
                 this.wasstable = true;
154 158
             } else if (
@@ -165,7 +169,9 @@ export default class JingleSessionPC extends JingleSession {
165 169
          * the value of RTCPeerConnection.iceConnectionState changes.
166 170
          */
167 171
         this.peerconnection.oniceconnectionstatechange = () => {
168
-            if (!this.peerconnection) {return;}
172
+            if (!this.peerconnection) {
173
+return;
174
+}
169 175
             const now = window.performance.now();
170 176
             this.room.connectionTimes["ice.state." +
171 177
             this.peerconnection.iceConnectionState] = now;
@@ -189,14 +195,16 @@ export default class JingleSessionPC extends JingleSession {
189 195
 
190 196
                     break;
191 197
                 case 'disconnected':
192
-                    if (this.closed)
193
-                        {break;}
198
+                    if (this.closed)                        {
199
+break;
200
+}
194 201
                     this.isreconnect = true;
195 202
                     // Informs interested parties that the connection has been
196 203
                     // interrupted.
197
-                    if (this.wasstable)
198
-                        {this.room.eventEmitter.emit(
199
-                            XMPPEvents.CONNECTION_INTERRUPTED);}
204
+                    if (this.wasstable)                        {
205
+this.room.eventEmitter.emit(
206
+                            XMPPEvents.CONNECTION_INTERRUPTED);
207
+}
200 208
                     break;
201 209
                 case 'failed':
202 210
                     this.room.eventEmitter.emit(
@@ -228,7 +236,9 @@ export default class JingleSessionPC extends JingleSession {
228 236
                 if (this.drip_container.length === 0) {
229 237
                     // start 20ms callout
230 238
                     setTimeout(() => {
231
-                        if (this.drip_container.length === 0) {return;}
239
+                        if (this.drip_container.length === 0) {
240
+return;
241
+}
232 242
                         this.sendIceCandidates(this.drip_container);
233 243
                         this.drip_container = [];
234 244
                     }, 20);
@@ -658,14 +668,16 @@ export default class JingleSessionPC extends JingleSession {
658 668
                 }
659 669
                 $(this).find('>parameter').each(function () {
660 670
                     lines += 'a=ssrc:' + ssrc + ' ' + $(this).attr('name');
661
-                    if ($(this).attr('value') && $(this).attr('value').length)
662
-                        {lines += ':' + $(this).attr('value');}
671
+                    if ($(this).attr('value') && $(this).attr('value').length)                        {
672
+lines += ':' + $(this).attr('value');
673
+}
663 674
                     lines += '\r\n';
664 675
                 });
665 676
             });
666 677
             currentRemoteSdp.media.forEach(function(media, idx) {
667
-                if (!SDPUtil.find_line(media, 'a=mid:' + name))
668
-                    {return;}
678
+                if (!SDPUtil.find_line(media, 'a=mid:' + name))                    {
679
+return;
680
+}
669 681
                 if (!addSsrcInfo[idx]) {
670 682
                     addSsrcInfo[idx] = '';
671 683
                 }
@@ -890,18 +902,24 @@ export default class JingleSessionPC extends JingleSession {
890 902
                             logger.debug("Renegotiate: setting local description");
891 903
                             this.peerconnection.setLocalDescription(
892 904
                                 answer,
893
-                                () => { resolve(); },
905
+                                () => {
906
+ resolve(); 
907
+},
894 908
                                 (error) => {
895 909
                                     reject(
896 910
                                         "setLocalDescription failed: " + error);
897 911
                                 }
898 912
                             );
899 913
                         },
900
-                        (error) => { reject("createAnswer failed: " + error); },
914
+                        (error) => {
915
+ reject("createAnswer failed: " + error); 
916
+},
901 917
                         media_constraints
902 918
                     );
903 919
                 },
904
-                (error) => { reject("setRemoteDescription failed: " + error); }
920
+                (error) => {
921
+ reject("setRemoteDescription failed: " + error); 
922
+}
905 923
             );
906 924
         });
907 925
     }
@@ -1022,8 +1040,9 @@ export default class JingleSessionPC extends JingleSession {
1022 1040
                 ssrcs.push(ssrc);
1023 1041
             });
1024 1042
             currentRemoteSdp.media.forEach(function(media, idx) {
1025
-                if (!SDPUtil.find_line(media, 'a=mid:' + name))
1026
-                    {return;}
1043
+                if (!SDPUtil.find_line(media, 'a=mid:' + name))                    {
1044
+return;
1045
+}
1027 1046
                 if (!removeSsrcInfo[idx]) {
1028 1047
                     removeSsrcInfo[idx] = '';
1029 1048
                 }
@@ -1317,8 +1336,9 @@ export default class JingleSessionPC extends JingleSession {
1317 1336
             if (errorElSel.length) {
1318 1337
                 error.code = errorElSel.attr('code');
1319 1338
                 const errorReasonSel = $(errResponse).find('error :first');
1320
-                if (errorReasonSel.length)
1321
-                    {error.reason = errorReasonSel[0].tagName;}
1339
+                if (errorReasonSel.length)                    {
1340
+error.reason = errorReasonSel[0].tagName;
1341
+}
1322 1342
             }
1323 1343
 
1324 1344
             if (!errResponse) {
@@ -1430,8 +1450,9 @@ export default class JingleSessionPC extends JingleSession {
1430 1450
             ssrcs.forEach(function (ssrcObj) {
1431 1451
                 const desc = $(jingle.tree()).find(">jingle>content[name=\"" +
1432 1452
                     ssrcObj.mtype + "\"]>description");
1433
-                if (!desc || !desc.length)
1434
-                    {return;}
1453
+                if (!desc || !desc.length)                    {
1454
+return;
1455
+}
1435 1456
                 ssrcObj.ssrcs.forEach(function (ssrc) {
1436 1457
                     const sourceNode = desc.find(">source[ssrc=\"" +
1437 1458
                         ssrc + "\"]");
@@ -1495,8 +1516,8 @@ export default class JingleSessionPC extends JingleSession {
1495 1516
     fixSourceRemoveJingle(jingle) {
1496 1517
         let ssrcs = this.modifiedSSRCs["mute"];
1497 1518
         this.modifiedSSRCs["mute"] = [];
1498
-        if (ssrcs && ssrcs.length)
1499
-            {ssrcs.forEach(function (ssrcObj) {
1519
+        if (ssrcs && ssrcs.length)            {
1520
+ssrcs.forEach(function (ssrcObj) {
1500 1521
                 ssrcObj.ssrcs.forEach(function (ssrc) {
1501 1522
                     const sourceNode
1502 1523
                         = $(jingle.tree()).find(">jingle>content[name=\"" +
@@ -1513,12 +1534,13 @@ export default class JingleSessionPC extends JingleSession {
1513 1534
                             group.ssrcs[0] + "\"])");
1514 1535
                     groupNode.remove();
1515 1536
                 });
1516
-            });}
1537
+            });
1538
+}
1517 1539
 
1518 1540
         ssrcs = this.modifiedSSRCs["remove"];
1519 1541
         this.modifiedSSRCs["remove"] = [];
1520
-        if (ssrcs && ssrcs.length)
1521
-            {ssrcs.forEach(function (ssrcObj) {
1542
+        if (ssrcs && ssrcs.length)            {
1543
+ssrcs.forEach(function (ssrcObj) {
1522 1544
                 const desc
1523 1545
                     = JingleSessionPC.createDescriptionNode(
1524 1546
                         jingle, ssrcObj.mtype);
@@ -1548,7 +1570,8 @@ export default class JingleSessionPC extends JingleSession {
1548 1570
                             "</ssrc-group>");
1549 1571
                     }
1550 1572
                 });
1551
-            });}
1573
+            });
1574
+}
1552 1575
     }
1553 1576
 
1554 1577
     /**

+ 26
- 17
modules/xmpp/SDP.js Vedi File

@@ -92,8 +92,9 @@ SDP.prototype.containsSSRC = function (ssrc) {
92 92
     var medias = this.getMediaSsrcMap();
93 93
     var result = false;
94 94
     Object.keys(medias).forEach(function (mediaindex) {
95
-        if (result)
96
-            {return;}
95
+        if (result)            {
96
+return;
97
+}
97 98
         if (medias[mediaindex].ssrcs[ssrc]) {
98 99
             result = true;
99 100
         }
@@ -108,15 +109,17 @@ SDP.prototype.mangle = function () {
108 109
         lines = this.media[i].split('\r\n');
109 110
         lines.pop(); // remove empty last element
110 111
         mline = SDPUtil.parse_mline(lines.shift());
111
-        if (mline.media != 'audio')
112
-            {continue;}
112
+        if (mline.media != 'audio')            {
113
+continue;
114
+}
113 115
         newdesc = '';
114 116
         mline.fmt.length = 0;
115 117
         for (j = 0; j < lines.length; j++) {
116 118
             if (lines[j].substr(0, 9) == 'a=rtpmap:') {
117 119
                 rtpmap = SDPUtil.parse_rtpmap(lines[j]);
118
-                if (rtpmap.name == 'CN' || rtpmap.name == 'ISAC')
119
-                    {continue;}
120
+                if (rtpmap.name == 'CN' || rtpmap.name == 'ISAC')                    {
121
+continue;
122
+}
120 123
                 mline.fmt.push(rtpmap.id);
121 124
             }
122 125
             newdesc += lines[j] + '\r\n';
@@ -368,8 +371,9 @@ SDP.prototype.transportToJingle = function (mediaindex, elem) {
368 371
                 protocol: sctpAttrs[1] /* protocol */
369 372
             });
370 373
         // Optional stream count attribute
371
-        if (sctpAttrs.length > 2)
372
-            {elem.attrs({ streams: sctpAttrs[2]});}
374
+        if (sctpAttrs.length > 2)            {
375
+elem.attrs({ streams: sctpAttrs[2]});
376
+}
373 377
         elem.up();
374 378
     }
375 379
     // XEP-0320
@@ -512,7 +516,9 @@ SDP.prototype.jingle2media = function (content) {
512 516
     }
513 517
     if (!sctp.length) {
514 518
         tmp.fmt = desc.find('payload-type').map(
515
-            function () { return this.getAttribute('id'); }).get();
519
+            function () {
520
+ return this.getAttribute('id');
521
+}).get();
516 522
         media += SDPUtil.build_mline(tmp) + '\r\n';
517 523
     } else {
518 524
         media += 'm=application 1 DTLS/SCTP ' + sctp.attr('number') + '\r\n';
@@ -520,15 +526,17 @@ SDP.prototype.jingle2media = function (content) {
520 526
             ' ' + sctp.attr('protocol');
521 527
 
522 528
         var streamCount = sctp.attr('streams');
523
-        if (streamCount)
524
-            {media += ' ' + streamCount + '\r\n';}
525
-        else
526
-            {media += '\r\n';}
529
+        if (streamCount)            {
530
+media += ' ' + streamCount + '\r\n';
531
+}        else            {
532
+media += '\r\n';
533
+}
527 534
     }
528 535
 
529 536
     media += 'c=IN IP4 0.0.0.0\r\n';
530
-    if (!sctp.length)
531
-        {media += 'a=rtcp:1 IN IP4 0.0.0.0\r\n';}
537
+    if (!sctp.length)        {
538
+media += 'a=rtcp:1 IN IP4 0.0.0.0\r\n';
539
+}
532 540
     tmp = content.find('>transport[xmlns="urn:xmpp:jingle:transports:ice-udp:1"]');
533 541
     if (tmp.length) {
534 542
         if (tmp.attr('ufrag')) {
@@ -640,8 +648,9 @@ SDP.prototype.jingle2media = function (content) {
640 648
             var value = this.getAttribute('value');
641 649
             value = SDPUtil.filter_special_chars(value);
642 650
             media += 'a=ssrc:' + ssrc + ' ' + name;
643
-            if (value && value.length)
644
-                {media += ':' + value;}
651
+            if (value && value.length)                {
652
+media += ':' + value;
653
+}
645 654
             media += '\r\n';
646 655
         });
647 656
     });

+ 11
- 10
modules/xmpp/SDPDiffer.js Vedi File

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

+ 7
- 6
modules/xmpp/SDPUtil.js Vedi File

@@ -66,8 +66,7 @@ var SDPUtil = {
66 66
      * @param line eg. "a=sctpmap:5000 webrtc-datachannel"
67 67
      * @returns [SCTP port number, protocol, streams]
68 68
      */
69
-    parse_sctpmap: function (line)
70
-    {
69
+    parse_sctpmap: function (line)    {
71 70
         var parts = line.substring(10).split(' ');
72 71
         var sctpPort = parts[0];
73 72
         var protocol = parts[1];
@@ -245,8 +244,9 @@ var SDPUtil = {
245 244
         var lines = haystack.split('\r\n'),
246 245
             needles = [];
247 246
         for (var i = 0; i < lines.length; i++) {
248
-            if (lines[i].substring(0, needle.length) == needle)
249
-                {needles.push(lines[i]);}
247
+            if (lines[i].substring(0, needle.length) == needle)                {
248
+needles.push(lines[i]);
249
+}
250 250
         }
251 251
         if (needles.length || !sessionpart) {
252 252
             return needles;
@@ -270,8 +270,9 @@ var SDPUtil = {
270 270
             logger.log(line);
271 271
             return null;
272 272
         }
273
-        if (line.substring(line.length - 2) == '\r\n') // chomp it
274
-            {line = line.substring(0, line.length - 2);}
273
+        if (line.substring(line.length - 2) == '\r\n') {// chomp it
274
+            line = line.substring(0, line.length - 2);
275
+        }
275 276
         var candidate = {},
276 277
             elems = line.split(' '),
277 278
             i;

+ 3
- 1
modules/xmpp/SdpTransformUtil.js Vedi File

@@ -157,7 +157,9 @@ class MLineWrap {
157 157
      */
158 158
     containsSSRC(ssrcNumber) {
159 159
         return !!this._ssrcs.find(
160
-            ssrcObj => { return ssrcObj.id == ssrcNumber; });
160
+            ssrcObj => {
161
+ return ssrcObj.id == ssrcNumber; 
162
+});
161 163
     }
162 164
 
163 165
     /**

+ 20
- 18
modules/xmpp/recording.js Vedi File

@@ -55,27 +55,28 @@ Recording.action = {
55 55
 
56 56
 Recording.prototype.handleJibriPresence = function (jibri) {
57 57
     var attributes = jibri.attributes;
58
-    if(!attributes)
59
-        {return;}
58
+    if(!attributes)        {
59
+return;
60
+}
60 61
 
61 62
     var newState = attributes.status;
62 63
     logger.log("Handle jibri presence : ", newState);
63 64
 
64
-    if (newState === this.state)
65
-        {return;}
65
+    if (newState === this.state)        {
66
+return;
67
+}
66 68
 
67 69
     if (newState === "undefined") {
68 70
         this.state = Recording.status.UNAVAILABLE;
69
-    }
70
-    else if (newState === "off") {
71
+    }    else if (newState === "off") {
71 72
         if (!this.state
72 73
             || this.state === "undefined"
73
-            || this.state === Recording.status.UNAVAILABLE)
74
-            {this.state = Recording.status.AVAILABLE;}
75
-        else
76
-            {this.state = Recording.status.OFF;}
77
-    }
78
-    else {
74
+            || this.state === Recording.status.UNAVAILABLE)            {
75
+this.state = Recording.status.AVAILABLE;
76
+}        else            {
77
+this.state = Recording.status.OFF;
78
+}
79
+    }    else {
79 80
         this.state = newState;
80 81
     }
81 82
 
@@ -224,12 +225,13 @@ Recording.prototype.toggleRecording = function (options, statusChangeHandler) {
224 225
 
225 226
     // If the recorder is currently unavailable we throw an error.
226 227
     if (oldState === Recording.status.UNAVAILABLE
227
-        || oldState === Recording.status.FAILED)
228
-        {statusChangeHandler(Recording.status.FAILED,
229
-                            JitsiRecorderErrors.RECORDER_UNAVAILABLE);}
230
-    else if (oldState === Recording.status.BUSY)
231
-        {statusChangeHandler(Recording.status.BUSY,
232
-                            JitsiRecorderErrors.RECORDER_BUSY);}
228
+        || oldState === Recording.status.FAILED)        {
229
+statusChangeHandler(Recording.status.FAILED,
230
+                            JitsiRecorderErrors.RECORDER_UNAVAILABLE);
231
+}    else if (oldState === Recording.status.BUSY)        {
232
+statusChangeHandler(Recording.status.BUSY,
233
+                            JitsiRecorderErrors.RECORDER_BUSY);
234
+}
233 235
 
234 236
     // If we're about to turn ON the recording we need either a streamId or
235 237
     // an authentication token depending on the recording type. If we don't

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

@@ -61,8 +61,9 @@ class MucConnectionPlugin extends ConnectionPluginListenable {
61 61
         }
62 62
 
63 63
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
64
-        if(!room)
65
-            {return;}
64
+        if(!room)            {
65
+return;
66
+}
66 67
 
67 68
         // Parse status.
68 69
         if ($(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]' +
@@ -78,8 +79,9 @@ class MucConnectionPlugin extends ConnectionPluginListenable {
78 79
     onPresenceUnavailable (pres) {
79 80
         const from = pres.getAttribute('from');
80 81
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
81
-        if(!room)
82
-            {return;}
82
+        if(!room)            {
83
+return;
84
+}
83 85
 
84 86
         room.onPresenceUnavailable(pres, from);
85 87
         return true;
@@ -88,8 +90,9 @@ class MucConnectionPlugin extends ConnectionPluginListenable {
88 90
     onPresenceError (pres) {
89 91
         const from = pres.getAttribute('from');
90 92
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
91
-        if(!room)
92
-            {return;}
93
+        if(!room)            {
94
+return;
95
+}
93 96
 
94 97
         room.onPresenceError(pres, from);
95 98
         return true;
@@ -99,8 +102,9 @@ class MucConnectionPlugin extends ConnectionPluginListenable {
99 102
         // FIXME: this is a hack. but jingle on muc makes nickchanges hard
100 103
         const from = msg.getAttribute('from');
101 104
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
102
-        if(!room)
103
-            {return;}
105
+        if(!room)            {
106
+return;
107
+}
104 108
 
105 109
         room.onMessage(msg, from);
106 110
         return true;
@@ -109,8 +113,9 @@ class MucConnectionPlugin extends ConnectionPluginListenable {
109 113
     onMute(iq) {
110 114
         const from = iq.getAttribute('from');
111 115
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
112
-        if(!room)
113
-            {return;}
116
+        if(!room)            {
117
+return;
118
+}
114 119
 
115 120
         room.onMute(iq);
116 121
         return true;

+ 11
- 7
modules/xmpp/xmpp.js Vedi File

@@ -92,7 +92,9 @@ export default class XMPP extends Listenable {
92 92
         }
93 93
     }
94 94
 
95
-    getConnection () { return this.connection; }
95
+    getConnection () {
96
+ return this.connection; 
97
+}
96 98
 
97 99
     /**
98 100
      * Receive connection status changes and handles them.
@@ -119,14 +121,16 @@ export default class XMPP extends Listenable {
119 121
             this.connection.ping.hasPingSupport(
120 122
                 pingJid,
121 123
                 function (hasPing) {
122
-                    if (hasPing)
123
-                        {this.connection.ping.startInterval(pingJid);}
124
-                    else
125
-                        {logger.warn("Ping NOT supported by " + pingJid);}
124
+                    if (hasPing)                        {
125
+this.connection.ping.startInterval(pingJid);
126
+}                    else                        {
127
+logger.warn("Ping NOT supported by " + pingJid);
128
+}
126 129
                 }.bind(this));
127 130
 
128
-            if (password)
129
-                {this.authenticatedUser = true;}
131
+            if (password)                {
132
+this.authenticatedUser = true;
133
+}
130 134
             if (this.connection && this.connection.connected &&
131 135
                 Strophe.getResourceFromJid(this.connection.jid)) {
132 136
                 // .connected is true while connecting?

Loading…
Annulla
Salva