ソースを参照

fix(eslint): Add brace-style rule

master
hristoterezov 8年前
コミット
f02a22d3f9
40個のファイルの変更676行の追加523行の削除
  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 ファイルの表示

77
         'consistent-return': 0,
77
         'consistent-return': 0,
78
         'curly': 2,
78
         'curly': 2,
79
 
79
 
80
+        // Stylistic issues group
81
+        'brace-style': 2,
82
+
80
         'prefer-const': 2,
83
         'prefer-const': 2,
81
         'prefer-reflect': 0,
84
         'prefer-reflect': 0,
82
         'prefer-spread': 2,
85
         'prefer-spread': 2,

+ 66
- 44
JitsiConference.js ファイルの表示

94
  * @param connection {JitsiConnection} overrides this.connection
94
  * @param connection {JitsiConnection} overrides this.connection
95
  */
95
  */
96
 JitsiConference.prototype._init = function (options) {
96
 JitsiConference.prototype._init = function (options) {
97
-    if (!options)
98
-        {options = {};}
97
+    if (!options)        {
98
+options = {};
99
+}
99
 
100
 
100
     // Override connection and xmpp properties (Usefull if the connection
101
     // Override connection and xmpp properties (Usefull if the connection
101
     // reloaded)
102
     // reloaded)
151
  * @param password {string} the password
152
  * @param password {string} the password
152
  */
153
  */
153
 JitsiConference.prototype.join = function (password) {
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
     this.getLocalTracks().forEach(track => this.onLocalTrackRemoved(track));
177
     this.getLocalTracks().forEach(track => this.onLocalTrackRemoved(track));
176
 
178
 
177
     this.rtc.closeAllDataChannels();
179
     this.rtc.closeAllDataChannels();
178
-    if (this.statistics)
179
-        {this.statistics.dispose();}
180
+    if (this.statistics)        {
181
+this.statistics.dispose();
182
+}
180
 
183
 
181
     // leave the conference
184
     // leave the conference
182
     if (this.room) {
185
     if (this.room) {
294
  * Note: consider adding eventing functionality by extending an EventEmitter impl, instead of rolling ourselves
297
  * Note: consider adding eventing functionality by extending an EventEmitter impl, instead of rolling ourselves
295
  */
298
  */
296
 JitsiConference.prototype.on = function (eventId, handler) {
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
  * Note: consider adding eventing functionality by extending an EventEmitter impl, instead of rolling ourselves
310
  * Note: consider adding eventing functionality by extending an EventEmitter impl, instead of rolling ourselves
307
  */
311
  */
308
 JitsiConference.prototype.off = function (eventId, handler) {
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
 // Common aliases for event emitter
318
 // Common aliases for event emitter
321
  * @param handler {Function} handler for the command
326
  * @param handler {Function} handler for the command
322
  */
327
  */
323
  JitsiConference.prototype.addCommandListener = function (command, handler) {
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
   * @param command {String} the name of the command
336
   * @param command {String} the name of the command
331
   */
337
   */
332
  JitsiConference.prototype.removeCommandListener = function (command) {
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
  * @param message the text message.
346
  * @param message the text message.
340
  */
347
  */
341
 JitsiConference.prototype.sendTextMessage = function (message) {
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
  * @param name {String} the name of the command.
378
  * @param name {String} the name of the command.
371
  **/
379
  **/
372
 JitsiConference.prototype.removeCommand = function (name) {
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
     // send event for stopping screen sharing
496
     // send event for stopping screen sharing
488
     // FIXME: we assume we have only one screen sharing track
497
     // FIXME: we assume we have only one screen sharing track
489
     // if we change this we need to fix this check
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
     this.eventEmitter.emit(JitsiConferenceEvents.TRACK_REMOVED, track);
503
     this.eventEmitter.emit(JitsiConferenceEvents.TRACK_REMOVED, track);
494
 };
504
 };
625
     // send event for starting screen sharing
635
     // send event for starting screen sharing
626
     // FIXME: we assume we have only one screen sharing track
636
     // FIXME: we assume we have only one screen sharing track
627
     // if we change this we need to fix this check
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
     this.eventEmitter.emit(JitsiConferenceEvents.TRACK_ADDED, newTrack);
642
     this.eventEmitter.emit(JitsiConferenceEvents.TRACK_ADDED, newTrack);
632
 };
643
 };
877
     }.bind(this));
888
     }.bind(this));
878
 
889
 
879
     // there can be no participant in case the member that left is focus
890
     // there can be no participant in case the member that left is focus
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
 JitsiConference.prototype.onUserRoleChanged = function (jid, role) {
897
 JitsiConference.prototype.onUserRoleChanged = function (jid, role) {
899
         return;
911
         return;
900
     }
912
     }
901
 
913
 
902
-    if (participant._displayName === displayName)
903
-        {return;}
914
+    if (participant._displayName === displayName)        {
915
+return;
916
+}
904
 
917
 
905
     participant._displayName = displayName;
918
     participant._displayName = displayName;
906
     this.eventEmitter.emit(JitsiConferenceEvents.DISPLAY_NAME_CHANGED, id, displayName);
919
     this.eventEmitter.emit(JitsiConferenceEvents.DISPLAY_NAME_CHANGED, id, displayName);
1217
  * Returns true if recording is supported and false if not.
1230
  * Returns true if recording is supported and false if not.
1218
  */
1231
  */
1219
 JitsiConference.prototype.isRecordingSupported = function () {
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
     return false;
1236
     return false;
1223
 };
1237
 };
1224
 
1238
 
1241
  * Starts/stops the recording
1255
  * Starts/stops the recording
1242
  */
1256
  */
1243
 JitsiConference.prototype.toggleRecording = function (options) {
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
             this.eventEmitter.emit(
1260
             this.eventEmitter.emit(
1247
                 JitsiConferenceEvents.RECORDER_STATE_CHANGED, status, error);
1261
                 JitsiConferenceEvents.RECORDER_STATE_CHANGED, status, error);
1248
-        }.bind(this));}
1262
+        }.bind(this));
1263
+}
1249
     this.eventEmitter.emit(
1264
     this.eventEmitter.emit(
1250
         JitsiConferenceEvents.RECORDER_STATE_CHANGED, "error",
1265
         JitsiConferenceEvents.RECORDER_STATE_CHANGED, "error",
1251
         new Error("The conference is not created yet!"));
1266
         new Error("The conference is not created yet!"));
1255
  * Returns true if the SIP calls are supported and false otherwise
1270
  * Returns true if the SIP calls are supported and false otherwise
1256
  */
1271
  */
1257
 JitsiConference.prototype.isSIPCallingSupported = function () {
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
     return false;
1276
     return false;
1261
 };
1277
 };
1262
 
1278
 
1265
  * @param number the number
1281
  * @param number the number
1266
  */
1282
  */
1267
 JitsiConference.prototype.dial = function (number) {
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
     return new Promise(function(resolve, reject){
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
  * Hangup an existing call
1293
  * Hangup an existing call
1276
  */
1294
  */
1277
 JitsiConference.prototype.hangup = function () {
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
     return new Promise(function(resolve, reject){
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
  * Returns the phone number for joining the conference.
1305
  * Returns the phone number for joining the conference.
1286
  */
1306
  */
1287
 JitsiConference.prototype.getPhoneNumber = function () {
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
     return null;
1311
     return null;
1291
 };
1312
 };
1292
 
1313
 
1294
  * Returns the pin for joining the conference with phone.
1315
  * Returns the pin for joining the conference with phone.
1295
  */
1316
  */
1296
 JitsiConference.prototype.getPhonePin = function () {
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
     return null;
1321
     return null;
1300
 };
1322
 };
1301
 
1323
 

+ 12
- 8
JitsiConferenceEventManager.js ファイルの表示

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

+ 7
- 5
JitsiConnection.js ファイルの表示

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

+ 1
- 2
JitsiMediaDevices.js ファイルの表示

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

+ 10
- 7
JitsiMeetJS.js ファイルの表示

31
 var USER_MEDIA_PERMISSION_PROMPT_TIMEOUT = 500;
31
 var USER_MEDIA_PERMISSION_PROMPT_TIMEOUT = 500;
32
 
32
 
33
 function getLowerResolution(resolution) {
33
 function getLowerResolution(resolution) {
34
-    if(!Resolutions[resolution])
35
-        {return null;}
34
+    if(!Resolutions[resolution])        {
35
+return null;
36
+}
36
     var order = Resolutions[resolution].order;
37
     var order = Resolutions[resolution].order;
37
     var res = null;
38
     var res = null;
38
     var resName = null;
39
     var resName = null;
223
             }, USER_MEDIA_PERMISSION_PROMPT_TIMEOUT);
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
         window.connectionTimes["obtainPermissions.start"] =
230
         window.connectionTimes["obtainPermissions.start"] =
229
             window.performance.now();
231
             window.performance.now();
230
 
232
 
238
                 Statistics.analytics.sendEvent(addDeviceTypeToAnalyticsEvent(
240
                 Statistics.analytics.sendEvent(addDeviceTypeToAnalyticsEvent(
239
                     "getUserMedia.success", options), {value: options});
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
                         const track = tracks[i];
245
                         const track = tracks[i];
244
                         var mStream = track.getOriginalStream();
246
                         var mStream = track.getOriginalStream();
245
                         if(track.getType() === MediaType.AUDIO){
247
                         if(track.getType() === MediaType.AUDIO){
251
                                     Statistics.stopLocalStats(mStream);
253
                                     Statistics.stopLocalStats(mStream);
252
                                 });
254
                                 });
253
                         }
255
                         }
254
-                    }}
256
+                    }
257
+}
255
 
258
 
256
                 // set real device ids
259
                 // set real device ids
257
                 var currentlyAvailableMediaDevices
260
                 var currentlyAvailableMediaDevices

+ 29
- 20
doc/example/example.js ファイルの表示

19
  * Handles local tracks.
19
  * Handles local tracks.
20
  * @param tracks Array with JitsiTrack objects
20
  * @param tracks Array with JitsiTrack objects
21
  */
21
  */
22
-function onLocalTracks(tracks)
23
-{
22
+function onLocalTracks(tracks){
24
     localTracks = tracks;
23
     localTracks = tracks;
25
-    for(var i = 0; i < localTracks.length; i++)
26
-    {
24
+    for(var i = 0; i < localTracks.length; i++)    {
27
         localTracks[i].addEventListener(JitsiMeetJS.events.track.TRACK_AUDIO_LEVEL_CHANGED,
25
         localTracks[i].addEventListener(JitsiMeetJS.events.track.TRACK_AUDIO_LEVEL_CHANGED,
28
             function (audioLevel) {
26
             function (audioLevel) {
29
                 console.log("Audio Level local: " + audioLevel);
27
                 console.log("Audio Level local: " + audioLevel);
47
             $("body").append("<audio autoplay='1' muted='true' id='localAudio" + i + "' />");
45
             $("body").append("<audio autoplay='1' muted='true' id='localAudio" + i + "' />");
48
             localTracks[i].attach($("#localAudio" + i)[0]);
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
  * @param track JitsiTrack object
56
  * @param track JitsiTrack object
58
  */
57
  */
59
 function onRemoteTrack(track) {
58
 function onRemoteTrack(track) {
60
-    if(track.isLocal())
61
-        {return;}
59
+    if(track.isLocal())        {
60
+return;
61
+}
62
     var participant = track.getParticipantId();
62
     var participant = track.getParticipantId();
63
-    if(!remoteTracks[participant])
64
-        {remoteTracks[participant] = [];}
63
+    if(!remoteTracks[participant])        {
64
+remoteTracks[participant] = [];
65
+}
65
     var idx = remoteTracks[participant].push(track);
66
     var idx = remoteTracks[participant].push(track);
66
     track.addEventListener(JitsiMeetJS.events.track.TRACK_AUDIO_LEVEL_CHANGED,
67
     track.addEventListener(JitsiMeetJS.events.track.TRACK_AUDIO_LEVEL_CHANGED,
67
         function (audioLevel) {
68
         function (audioLevel) {
94
 function onConferenceJoined () {
95
 function onConferenceJoined () {
95
     console.log("conference joined!");
96
     console.log("conference joined!");
96
     isJoined = true;
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
 function onUserLeft(id) {
103
 function onUserLeft(id) {
102
     console.log("user left");
104
     console.log("user left");
103
-    if(!remoteTracks[id])
104
-        {return;}
105
+    if(!remoteTracks[id])        {
106
+return;
107
+}
105
     var tracks = remoteTracks[id];
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
         console.log("track removed!!!" + track);
121
         console.log("track removed!!!" + track);
118
     });
122
     });
119
     room.on(JitsiMeetJS.events.conference.CONFERENCE_JOINED, onConferenceJoined);
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
     room.on(JitsiMeetJS.events.conference.USER_LEFT, onUserLeft);
127
     room.on(JitsiMeetJS.events.conference.USER_LEFT, onUserLeft);
122
     room.on(JitsiMeetJS.events.conference.TRACK_MUTE_CHANGED, function (track) {
128
     room.on(JitsiMeetJS.events.conference.TRACK_MUTE_CHANGED, function (track) {
123
         console.log(track.getType() + " - " + track.isMuted());
129
         console.log(track.getType() + " - " + track.isMuted());
167
 }
173
 }
168
 
174
 
169
 function unload() {
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
     room.leave();
179
     room.leave();
173
     connection.disconnect();
180
     connection.disconnect();
174
 }
181
 }
252
 
259
 
253
 if (JitsiMeetJS.mediaDevices.isDeviceChangeAvailable('output')) {
260
 if (JitsiMeetJS.mediaDevices.isDeviceChangeAvailable('output')) {
254
     JitsiMeetJS.mediaDevices.enumerateDevices(function(devices) {
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
         if (audioOutputDevices.length > 1) {
266
         if (audioOutputDevices.length > 1) {
258
             $('#audioOutputSelect').html(
267
             $('#audioOutputSelect').html(

+ 13
- 16
modules/RTC/DataChannels.js ファイルの表示

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

+ 33
- 25
modules/RTC/JitsiLocalTrack.js ファイルの表示

34
     JitsiTrack.call(this,
34
     JitsiTrack.call(this,
35
         null /* RTC */, stream, track,
35
         null /* RTC */, stream, track,
36
         function () {
36
         function () {
37
-            if(!this.dontFireRemoveEvent)
38
-                {this.eventEmitter.emit(
39
-                    JitsiTrackEvents.LOCAL_TRACK_STOPPED);}
37
+            if(!this.dontFireRemoveEvent)                {
38
+this.eventEmitter.emit(
39
+                    JitsiTrackEvents.LOCAL_TRACK_STOPPED);
40
+}
40
             this.dontFireRemoveEvent = false;
41
             this.dontFireRemoveEvent = false;
41
         }.bind(this) /* inactiveHandler */,
42
         }.bind(this) /* inactiveHandler */,
42
         mediaType, videoType, null /* ssrc */);
43
         mediaType, videoType, null /* ssrc */);
45
 
46
 
46
     // FIXME: currently firefox is ignoring our constraints about resolutions
47
     // FIXME: currently firefox is ignoring our constraints about resolutions
47
     // so we do not store it, to avoid wrong reporting of local track resolution
48
     // so we do not store it, to avoid wrong reporting of local track resolution
48
-    if (RTCBrowserType.isFirefox())
49
-        {this.resolution = null;}
49
+    if (RTCBrowserType.isFirefox())        {
50
+this.resolution = null;
51
+}
50
 
52
 
51
     this.deviceId = deviceId;
53
     this.deviceId = deviceId;
52
     this.startMuted = false;
54
     this.startMuted = false;
182
  */
184
  */
183
 JitsiLocalTrack.prototype._onNoDataFromSourceError = function () {
185
 JitsiLocalTrack.prototype._onNoDataFromSourceError = function () {
184
     this._clearNoDataFromSourceMuteResources();
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
     if (this.isAudioTrack() ||
295
     if (this.isAudioTrack() ||
293
         this.videoType === VideoType.DESKTOP ||
296
         this.videoType === VideoType.DESKTOP ||
294
         RTCBrowserType.isFirefox()) {
297
         RTCBrowserType.isFirefox()) {
295
-        if(this.track)
296
-            {this.track.enabled = !mute;}
298
+        if(this.track)            {
299
+this.track.enabled = !mute;
300
+}
297
     } else {
301
     } else {
298
         if(mute) {
302
         if(mute) {
299
             this.dontFireRemoveEvent = true;
303
             this.dontFireRemoveEvent = true;
315
                 devices: [ MediaType.VIDEO ],
319
                 devices: [ MediaType.VIDEO ],
316
                 facingMode: this.getCameraFacingMode()
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
             promise = RTCUtils.obtainAudioAndVideoPermissions(streamOptions)
326
             promise = RTCUtils.obtainAudioAndVideoPermissions(streamOptions)
322
                 .then(function (streamsInfo) {
327
                 .then(function (streamsInfo) {
474
  */
479
  */
475
 JitsiLocalTrack.prototype.isMuted = function () {
480
 JitsiLocalTrack.prototype.isMuted = function () {
476
     // this.stream will be null when we mute local video on Chrome
481
     // this.stream will be null when we mute local video on Chrome
477
-    if (!this.stream)
478
-        {return true;}
482
+    if (!this.stream)        {
483
+return true;
484
+}
479
     if (this.isVideoTrack() && !this.isActive()) {
485
     if (this.isVideoTrack() && !this.isActive()) {
480
         return true;
486
         return true;
481
     } else {
487
     } else {
504
     // on "attach" call, but for local track we not always have the conference
510
     // on "attach" call, but for local track we not always have the conference
505
     // before attaching. However this may result in duplicated events if they
511
     // before attaching. However this may result in duplicated events if they
506
     // have been triggered on "attach" already.
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
         this._maybeFireTrackAttached(this.containers[i]);
514
         this._maybeFireTrackAttached(this.containers[i]);
510
     }
515
     }
511
 };
516
 };
518
  * @returns {string} or {null}
523
  * @returns {string} or {null}
519
  */
524
  */
520
 JitsiLocalTrack.prototype.getSSRC = function () {
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
  */
627
  */
622
 JitsiLocalTrack.prototype._checkForCameraIssues = function () {
628
 JitsiLocalTrack.prototype._checkForCameraIssues = function () {
623
     if(!this.isVideoTrack() || this.stopStreamInProgress ||
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
     return !this._isReceivingData();
634
     return !this._isReceivingData();
628
 };
635
 };
637
  * @returns {boolean} true if the stream is receiving data and false otherwise.
644
  * @returns {boolean} true if the stream is receiving data and false otherwise.
638
  */
645
  */
639
 JitsiLocalTrack.prototype._isReceivingData = function () {
646
 JitsiLocalTrack.prototype._isReceivingData = function () {
640
-    if(!this.stream)
641
-        {return false;}
647
+    if(!this.stream)        {
648
+return false;
649
+}
642
     // In older version of the spec there is no muted property and
650
     // In older version of the spec there is no muted property and
643
     // readyState can have value muted. In the latest versions
651
     // readyState can have value muted. In the latest versions
644
     // readyState can have values "live" and "ended" and there is
652
     // readyState can have values "live" and "ended" and there is

+ 28
- 20
modules/RTC/JitsiRemoteTrack.js ファイルの表示

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

+ 28
- 22
modules/RTC/JitsiTrack.js ファイルの表示

26
 function implementOnEndedHandling(jitsiTrack) {
26
 function implementOnEndedHandling(jitsiTrack) {
27
     var stream = jitsiTrack.getOriginalStream();
27
     var stream = jitsiTrack.getOriginalStream();
28
 
28
 
29
-    if(!stream)
30
-        {return;}
29
+    if(!stream)        {
30
+return;
31
+}
31
 
32
 
32
     var originalStop = stream.stop;
33
     var originalStop = stream.stop;
33
     stream.stop = function () {
34
     stream.stop = function () {
45
  */
46
  */
46
 function addMediaStreamInactiveHandler(mediaStream, handler) {
47
 function addMediaStreamInactiveHandler(mediaStream, handler) {
47
     // Temasys will use onended
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
  * @param ssrc the SSRC of this track if known
67
  * @param ssrc the SSRC of this track if known
66
  */
68
  */
67
 function JitsiTrack(conference, stream, track, streamInactiveHandler, trackMediaType,
69
 function JitsiTrack(conference, stream, track, streamInactiveHandler, trackMediaType,
68
-                    videoType, ssrc)
69
-{
70
+                    videoType, ssrc){
70
     /**
71
     /**
71
      * Array with the HTML elements that are displaying the streams.
72
      * Array with the HTML elements that are displaying the streams.
72
      * @type {Array}
73
      * @type {Array}
101
  */
102
  */
102
 JitsiTrack.prototype._setHandler = function (type, handler) {
103
 JitsiTrack.prototype._setHandler = function (type, handler) {
103
     this.handlers[type] = handler;
104
     this.handlers[type] = handler;
104
-    if(!this.stream)
105
-        {return;}
105
+    if(!this.stream)        {
106
+return;
107
+}
106
 
108
 
107
     if(type === "inactive") {
109
     if(type === "inactive") {
108
         if (RTCBrowserType.isFirefox()) {
110
         if (RTCBrowserType.isFirefox()) {
315
  * @returns {string|null} id of the track or null if this is fake track.
317
  * @returns {string|null} id of the track or null if this is fake track.
316
  */
318
  */
317
 JitsiTrack.prototype.getId = function () {
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
  * @returns {boolean} whether MediaStream is active.
331
  * @returns {boolean} whether MediaStream is active.
329
  */
332
  */
330
 JitsiTrack.prototype.isActive = function () {
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
  * @param handler handler for the event.
345
  * @param handler handler for the event.
342
  */
346
  */
343
 JitsiTrack.prototype.on = function (eventId, handler) {
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
  * @param [handler] optional, the specific handler to unbind
356
  * @param [handler] optional, the specific handler to unbind
352
  */
357
  */
353
 JitsiTrack.prototype.off = function (eventId, handler) {
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
 // Common aliases for event emitter
364
 // Common aliases for event emitter

+ 20
- 12
modules/RTC/RTC.js ファイルの表示

164
     selectEndpoint (id) {
164
     selectEndpoint (id) {
165
         // cache the value if channel is missing, till we open it
165
         // cache the value if channel is missing, till we open it
166
         this.selectedEndpoint = id;
166
         this.selectedEndpoint = id;
167
-        if(this.dataChannels && this.dataChannelsOpen)
168
-            {this.dataChannels.sendSelectedEndpointMessage(id);}
167
+        if(this.dataChannels && this.dataChannelsOpen)            {
168
+this.dataChannels.sendSelectedEndpointMessage(id);
169
+}
169
     }
170
     }
170
 
171
 
171
     /**
172
     /**
252
     }
253
     }
253
 
254
 
254
     addLocalTrack (track) {
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
         this.localTracks.push(track);
260
         this.localTracks.push(track);
259
 
261
 
288
         let tracks = this.localTracks.slice();
290
         let tracks = this.localTracks.slice();
289
         if (mediaType !== undefined) {
291
         if (mediaType !== undefined) {
290
             tracks = tracks.filter(
292
             tracks = tracks.filter(
291
-                (track) => { return track.getType() === mediaType; });
293
+                (track) => {
294
+ return track.getType() === mediaType; 
295
+});
292
         }
296
         }
293
         return tracks;
297
         return tracks;
294
     }
298
     }
330
      * @returns {JitsiRemoteTrack|null}
334
      * @returns {JitsiRemoteTrack|null}
331
      */
335
      */
332
     getRemoteTrackByType (type, resource) {
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
     dispose () { }
637
     dispose () { }
633
 
638
 
634
     setAudioLevel (resource, audioLevel) {
639
     setAudioLevel (resource, audioLevel) {
635
-        if(!resource)
636
-            {return;}
640
+        if(!resource)            {
641
+return;
642
+}
637
         var audioTrack = this.getRemoteAudioTrack(resource);
643
         var audioTrack = this.getRemoteAudioTrack(resource);
638
         if(audioTrack) {
644
         if(audioTrack) {
639
             audioTrack.setAudioLevel(audioLevel);
645
             audioTrack.setAudioLevel(audioLevel);
647
      */
653
      */
648
     getResourceBySSRC (ssrc) {
654
     getResourceBySSRC (ssrc) {
649
         if (this.getLocalTracks().find(
655
         if (this.getLocalTracks().find(
650
-                localTrack => { return localTrack.getSSRC() == ssrc; })) {
656
+                localTrack => {
657
+ return localTrack.getSSRC() == ssrc; 
658
+})) {
651
             return this.conference.myUserId();
659
             return this.conference.myUserId();
652
         }
660
         }
653
 
661
 

+ 3
- 2
modules/RTC/RTCBrowserType.js ファイルの表示

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

+ 19
- 19
modules/RTC/RTCUtils.js ファイルの表示

107
     if (Resolutions[resolution]) {
107
     if (Resolutions[resolution]) {
108
         constraints.video.mandatory.minWidth = Resolutions[resolution].width;
108
         constraints.video.mandatory.minWidth = Resolutions[resolution].width;
109
         constraints.video.mandatory.minHeight = Resolutions[resolution].height;
109
         constraints.video.mandatory.minHeight = Resolutions[resolution].height;
110
-    }
111
-    else if (isAndroid) {
110
+    }    else if (isAndroid) {
112
         // FIXME can't remember if the purpose of this was to always request
111
         // FIXME can't remember if the purpose of this was to always request
113
         //       low resolution on Android ? if yes it should be moved up front
112
         //       low resolution on Android ? if yes it should be moved up front
114
         constraints.video.mandatory.minWidth = 320;
113
         constraints.video.mandatory.minWidth = 320;
116
         constraints.video.mandatory.maxFrameRate = 15;
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
     // we turn audio for both audio and video tracks, the fake audio & video seems to work
294
     // we turn audio for both audio and video tracks, the fake audio & video seems to work
294
     // only when enabled in one getUserMedia call, we cannot get fake audio separate by fake video
295
     // only when enabled in one getUserMedia call, we cannot get fake audio separate by fake video
295
     // this later can be a problem with some of the tests
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
         // seems to be fixed now, removing this experimental fix, as having
298
         // seems to be fixed now, removing this experimental fix, as having
299
         // multiple audio tracks brake the tests
299
         // multiple audio tracks brake the tests
300
         //constraints.audio = true;
300
         //constraints.audio = true;
771
                     // https://github.com/webrtc/samples/issues/302
771
                     // https://github.com/webrtc/samples/issues/302
772
                     if (element) {
772
                     if (element) {
773
                         defaultSetVideoSrc(element, stream);
773
                         defaultSetVideoSrc(element, stream);
774
-                        if (stream)
775
-                            {element.play();}
774
+                        if (stream)                            {
775
+element.play();
776
+}
776
                     }
777
                     }
777
                     return element;
778
                     return element;
778
                 });
779
                 });
851
                         return this.audioTracks;
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
                 const webRTCReadyCb = () => {
857
                 const webRTCReadyCb = () => {
858
                     this.peerconnection = RTCPeerConnection;
858
                     this.peerconnection = RTCPeerConnection;
859
                     this.getUserMedia = window.getUserMedia;
859
                     this.getUserMedia = window.getUserMedia;
1054
                             var videoTracksReceived = !!stream.getVideoTracks().length;
1054
                             var videoTracksReceived = !!stream.getVideoTracks().length;
1055
 
1055
 
1056
                             if((audioDeviceRequested && !audioTracksReceived) ||
1056
                             if((audioDeviceRequested && !audioTracksReceived) ||
1057
-                                (videoDeviceRequested && !videoTracksReceived))
1058
-                            {
1057
+                                (videoDeviceRequested && !videoTracksReceived))                            {
1059
                                 self.stopMediaStream(stream);
1058
                                 self.stopMediaStream(stream);
1060
 
1059
 
1061
                                 // We are getting here in case if we requested
1060
                                 // We are getting here in case if we requested
1145
     }
1144
     }
1146
 
1145
 
1147
     _isDeviceListAvailable () {
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
         var isEnumerateDevicesAvailable
1150
         var isEnumerateDevicesAvailable
1151
             = navigator.mediaDevices && navigator.mediaDevices.enumerateDevices;
1151
             = navigator.mediaDevices && navigator.mediaDevices.enumerateDevices;
1152
         if (isEnumerateDevicesAvailable) {
1152
         if (isEnumerateDevicesAvailable) {

+ 19
- 18
modules/RTC/ScreenObtainer.js ファイルの表示

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

+ 6
- 4
modules/RTC/TraceablePeerConnection.js ファイルの表示

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

+ 9
- 6
modules/TalkMutedDetection.js ファイルの表示

59
     _audioLevel(ssrc, audioLevel, isLocal) {
59
     _audioLevel(ssrc, audioLevel, isLocal) {
60
         // We are interested in the local audio stream only and if event is not
60
         // We are interested in the local audio stream only and if event is not
61
         // sent yet.
61
         // sent yet.
62
-        if (!isLocal || !this.audioTrack || this._eventFired)
63
-            {return;}
62
+        if (!isLocal || !this.audioTrack || this._eventFired)            {
63
+return;
64
+}
64
 
65
 
65
         if (this.audioTrack.isMuted() && audioLevel > 0.6) {
66
         if (this.audioTrack.isMuted() && audioLevel > 0.6) {
66
             this._eventFired = true;
67
             this._eventFired = true;
91
      * @private
92
      * @private
92
      */
93
      */
93
     _trackAdded(track) {
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
      * @private
106
      * @private
105
      */
107
      */
106
     _trackMuteChanged(track) {
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 ファイルの表示

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

+ 10
- 10
modules/statistics/CallStats.js ファイルの表示

90
                 var error = report.data;
90
                 var error = report.data;
91
                 CallStats._reportError.call(this, error.type, error.error,
91
                 CallStats._reportError.call(this, error.type, error.error,
92
                     error.pc);
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
                 && fabricInitialized) {
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
                 var eventData = report.data;
97
                 var eventData = report.data;
99
                 callStats.sendFabricEvent(
98
                 callStats.sendFabricEvent(
100
                     this.peerconnection,
99
                     this.peerconnection,
212
  */
211
  */
213
 CallStats._checkInitialize = function () {
212
 CallStats._checkInitialize = function () {
214
     if (CallStats.initialized || !CallStats.initializeFailed
213
     if (CallStats.initialized || !CallStats.initializeFailed
215
-        || !callStats || CallStats.initializeInProgress)
216
-        {return;}
214
+        || !callStats || CallStats.initializeInProgress)        {
215
+return;
216
+}
217
 
217
 
218
     // callstats object created, not initialized and it had previously failed,
218
     // callstats object created, not initialized and it had previously failed,
219
     // and there is no init in progress, so lets try initialize it again
219
     // and there is no init in progress, so lets try initialize it again
236
 };
236
 };
237
 
237
 
238
 CallStats.prototype.pcCallback = _try_catch(function (err, msg) {
238
 CallStats.prototype.pcCallback = _try_catch(function (err, msg) {
239
-    if (callStats && err !== 'success')
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
                 ssrc,
279
                 ssrc,
279
                 usageLabel,
280
                 usageLabel,
280
                 containerId);
281
                 containerId);
281
-        }
282
-        else {
282
+        }        else {
283
             CallStats.reportsQueue.push({
283
             CallStats.reportsQueue.push({
284
                 type: reportType.MST_WITH_USERID,
284
                 type: reportType.MST_WITH_USERID,
285
                 data: {
285
                 data: {

+ 8
- 8
modules/statistics/LocalStatsCollector.js ファイルの表示

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

+ 45
- 40
modules/statistics/RTPStatsCollector.js ファイルの表示

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

+ 55
- 37
modules/statistics/statistics.js ファイルの表示

89
             // of callstats.io may be disabled because of globally-disallowed
89
             // of callstats.io may be disabled because of globally-disallowed
90
             // requests to any third parties.
90
             // requests to any third parties.
91
             && (Statistics.disableThirdPartyRequests !== true);
91
             && (Statistics.disableThirdPartyRequests !== true);
92
-    if(this.callStatsIntegrationEnabled)
93
-        {loadCallStatsAPI(this.options.callStatsCustomScriptUrl);}
92
+    if(this.callStatsIntegrationEnabled)        {
93
+loadCallStatsAPI(this.options.callStatsCustomScriptUrl);
94
+}
94
     this.callStats = null;
95
     this.callStats = null;
95
     // Flag indicates whether or not the CallStats have been started for this
96
     // Flag indicates whether or not the CallStats have been started for this
96
     // Statistics instance
97
     // Statistics instance
124
 Statistics.localStats = [];
125
 Statistics.localStats = [];
125
 
126
 
126
 Statistics.startLocalStats = function (stream, callback) {
127
 Statistics.startLocalStats = function (stream, callback) {
127
-    if(!Statistics.audioLevelsEnabled)
128
-        {return;}
128
+    if(!Statistics.audioLevelsEnabled)        {
129
+return;
130
+}
129
     var localStats = new LocalStats(stream, Statistics.audioLevelsInterval,
131
     var localStats = new LocalStats(stream, Statistics.audioLevelsInterval,
130
         callback);
132
         callback);
131
     this.localStats.push(localStats);
133
     this.localStats.push(localStats);
133
 };
135
 };
134
 
136
 
135
 Statistics.prototype.addAudioLevelListener = function(listener) {
137
 Statistics.prototype.addAudioLevelListener = function(listener) {
136
-    if(!Statistics.audioLevelsEnabled)
137
-        {return;}
138
+    if(!Statistics.audioLevelsEnabled)        {
139
+return;
140
+}
138
     this.eventEmitter.on(StatisticsEvents.AUDIO_LEVEL, listener);
141
     this.eventEmitter.on(StatisticsEvents.AUDIO_LEVEL, listener);
139
 };
142
 };
140
 
143
 
141
 Statistics.prototype.removeAudioLevelListener = function(listener) {
144
 Statistics.prototype.removeAudioLevelListener = function(listener) {
142
-    if(!Statistics.audioLevelsEnabled)
143
-        {return;}
145
+    if(!Statistics.audioLevelsEnabled)        {
146
+return;
147
+}
144
     this.eventEmitter.removeListener(StatisticsEvents.AUDIO_LEVEL, listener);
148
     this.eventEmitter.removeListener(StatisticsEvents.AUDIO_LEVEL, listener);
145
 };
149
 };
146
 
150
 
176
     }
180
     }
177
     this.stopCallStats();
181
     this.stopCallStats();
178
     this.stopRemoteStats();
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
 Statistics.stopLocalStats = function (stream) {
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
             var localStats = Statistics.localStats.splice(i, 1);
195
             var localStats = Statistics.localStats.splice(i, 1);
190
             localStats[0].stop();
196
             localStats[0].stop();
191
             break;
197
             break;
192
-        }}
198
+        }
199
+}
193
 };
200
 };
194
 
201
 
195
 Statistics.prototype.stopRemoteStats = function () {
202
 Statistics.prototype.stopRemoteStats = function () {
223
 Statistics.prototype.stopCallStats = function () {
230
 Statistics.prototype.stopCallStats = function () {
224
     if(this.callStatsStarted) {
231
     if(this.callStatsStarted) {
225
         var index = Statistics.callsStatsInstances.indexOf(this.callstats);
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
         // The next line is commented because we need to be able to send
236
         // The next line is commented because we need to be able to send
229
         // feedback even after the conference has been destroyed.
237
         // feedback even after the conference has been destroyed.
230
         // this.callstats = null;
238
         // this.callstats = null;
249
  * @param {RTCPeerConnection} pc connection on which failure occured.
257
  * @param {RTCPeerConnection} pc connection on which failure occured.
250
  */
258
  */
251
 Statistics.prototype.sendIceConnectionFailedEvent = function (pc) {
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
     Statistics.analytics.sendEvent('connection.ice_failed');
263
     Statistics.analytics.sendEvent('connection.ice_failed');
255
 };
264
 };
256
 
265
 
260
  * @param type {String} "audio"/"video"
269
  * @param type {String} "audio"/"video"
261
  */
270
  */
262
 Statistics.prototype.sendMuteEvent = function (muted, type) {
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
  * false for not stopping
280
  * false for not stopping
271
  */
281
  */
272
 Statistics.prototype.sendScreenSharingEvent = function (start) {
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
  * conference.
290
  * conference.
280
  */
291
  */
281
 Statistics.prototype.sendDominantSpeakerEvent = function () {
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
  * @param {RTCPeerConnection} pc connection on which failure occured.
360
  * @param {RTCPeerConnection} pc connection on which failure occured.
349
  */
361
  */
350
 Statistics.prototype.sendCreateOfferFailed = function (e, pc) {
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
  * @param {RTCPeerConnection} pc connection on which failure occured.
372
  * @param {RTCPeerConnection} pc connection on which failure occured.
360
  */
373
  */
361
 Statistics.prototype.sendCreateAnswerFailed = function (e, pc) {
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
  * @param {RTCPeerConnection} pc connection on which failure occured.
384
  * @param {RTCPeerConnection} pc connection on which failure occured.
371
  */
385
  */
372
 Statistics.prototype.sendSetLocalDescFailed = function (e, pc) {
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
  * @param {RTCPeerConnection} pc connection on which failure occured.
396
  * @param {RTCPeerConnection} pc connection on which failure occured.
382
  */
397
  */
383
 Statistics.prototype.sendSetRemoteDescFailed = function (e, pc) {
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
  * @param {RTCPeerConnection} pc connection on which failure occured.
408
  * @param {RTCPeerConnection} pc connection on which failure occured.
393
  */
409
  */
394
 Statistics.prototype.sendAddIceCandidateFailed = function (e, pc) {
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
  * @param detailed detailed feedback from the user. Not yet used
435
  * @param detailed detailed feedback from the user. Not yet used
419
  */
436
  */
420
 Statistics.prototype.sendFeedback = function(overall, detailed) {
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
     Statistics.analytics.sendEvent("feedback.rating",
441
     Statistics.analytics.sendEvent("feedback.rating",
424
         {value: overall, detailed: detailed});
442
         {value: overall, detailed: detailed});
425
 };
443
 };

+ 6
- 12
modules/transcription/audioRecorder.js ファイルの表示

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

+ 1
- 2
modules/transcription/transcriber.js ファイルの表示

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

+ 1
- 2
modules/transcription/transcriptionServices/AbstractTranscriptionService.js ファイルの表示

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

+ 6
- 10
modules/transcription/transcriptionServices/SphinxTranscriptionService.js ファイルの表示

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

+ 3
- 2
modules/util/EventEmitterForwarder.js ファイルの表示

7
  */
7
  */
8
 function EventEmitterForwarder (src, dest) {
8
 function EventEmitterForwarder (src, dest) {
9
     if (!src || !dest || typeof src.addListener !== "function" ||
9
     if (!src || !dest || typeof src.addListener !== "function" ||
10
-        typeof dest.emit !== "function")
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
     this.src = src;
13
     this.src = src;
13
     this.dest = dest;
14
     this.dest = dest;
14
 }
15
 }

+ 12
- 8
modules/util/GlobalOnErrorHandler.js ファイルの表示

22
     handlers.forEach(function (handler) {
22
     handlers.forEach(function (handler) {
23
         handler(message, source, lineno, colno, error);
23
         handler(message, source, lineno, colno, error);
24
     });
24
     });
25
-    if (oldOnErrorHandler)
26
-        {oldOnErrorHandler(message, source, lineno, colno, error);}
25
+    if (oldOnErrorHandler)        {
26
+oldOnErrorHandler(message, source, lineno, colno, error);
27
+}
27
 }
28
 }
28
 
29
 
29
 // If an old handler exists, also fire its events.
30
 // If an old handler exists, also fire its events.
37
     handlers.forEach(function (handler) {
38
     handlers.forEach(function (handler) {
38
         handler(null, null, null, null, event.reason);
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
 // Setting the custom error handlers.
46
 // Setting the custom error handlers.
60
      */
62
      */
61
     callErrorHandler: function (error) {
63
     callErrorHandler: function (error) {
62
         var errHandler = window.onerror;
64
         var errHandler = window.onerror;
63
-        if(!errHandler)
64
-            {return;}
65
+        if(!errHandler)            {
66
+return;
67
+}
65
         errHandler(null, null, null, null, error);
68
         errHandler(null, null, null, null, error);
66
     },
69
     },
67
     /**
70
     /**
70
      */
73
      */
71
     callUnhandledRejectionHandler: function (error) {
74
     callUnhandledRejectionHandler: function (error) {
72
         var errHandler = window.onunhandledrejection;
75
         var errHandler = window.onunhandledrejection;
73
-        if(!errHandler)
74
-            {return;}
76
+        if(!errHandler)            {
77
+return;
78
+}
75
         errHandler(error);
79
         errHandler(error);
76
     }
80
     }
77
 };
81
 };

+ 9
- 6
modules/util/ScriptUtil.js ファイルの表示

38
                 var scriptSrc = scriptEl.src;
38
                 var scriptSrc = scriptEl.src;
39
                 var baseScriptSrc
39
                 var baseScriptSrc
40
                     = scriptSrc.substring(0, scriptSrc.lastIndexOf('/') + 1);
40
                     = scriptSrc.substring(0, scriptSrc.lastIndexOf('/') + 1);
41
-                if (scriptSrc && baseScriptSrc)
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
         script.src = src;
54
         script.src = src;
52
         if (prepend) {
55
         if (prepend) {

+ 3
- 2
modules/version/ComponentsVersions.js ファイルの表示

74
     }.bind(this));
74
     }.bind(this));
75
 
75
 
76
     // logs versions to stats
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 ファイルの表示

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

+ 61
- 48
modules/xmpp/ChatRoom.js ファイルの表示

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

+ 54
- 31
modules/xmpp/JingleSessionPC.js ファイルの表示

130
                 if (typeof protocol === 'string') {
130
                 if (typeof protocol === 'string') {
131
                     protocol = protocol.toLowerCase();
131
                     protocol = protocol.toLowerCase();
132
                     if (protocol === 'tcp' || protocol === 'ssltcp') {
132
                     if (protocol === 'tcp' || protocol === 'ssltcp') {
133
-                        if (this.webrtcIceTcpDisable)
134
-                            {return;}
133
+                        if (this.webrtcIceTcpDisable)                            {
134
+return;
135
+}
135
                     } else if (protocol == 'udp') {
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
         // "closed" instead.
150
         // "closed" instead.
149
         // I suppose at some point this will be moved to onconnectionstatechange
151
         // I suppose at some point this will be moved to onconnectionstatechange
150
         this.peerconnection.onsignalingstatechange = () => {
152
         this.peerconnection.onsignalingstatechange = () => {
151
-            if (!this.peerconnection) {return;}
153
+            if (!this.peerconnection) {
154
+return;
155
+}
152
             if (this.peerconnection.signalingState === 'stable') {
156
             if (this.peerconnection.signalingState === 'stable') {
153
                 this.wasstable = true;
157
                 this.wasstable = true;
154
             } else if (
158
             } else if (
165
          * the value of RTCPeerConnection.iceConnectionState changes.
169
          * the value of RTCPeerConnection.iceConnectionState changes.
166
          */
170
          */
167
         this.peerconnection.oniceconnectionstatechange = () => {
171
         this.peerconnection.oniceconnectionstatechange = () => {
168
-            if (!this.peerconnection) {return;}
172
+            if (!this.peerconnection) {
173
+return;
174
+}
169
             const now = window.performance.now();
175
             const now = window.performance.now();
170
             this.room.connectionTimes["ice.state." +
176
             this.room.connectionTimes["ice.state." +
171
             this.peerconnection.iceConnectionState] = now;
177
             this.peerconnection.iceConnectionState] = now;
189
 
195
 
190
                     break;
196
                     break;
191
                 case 'disconnected':
197
                 case 'disconnected':
192
-                    if (this.closed)
193
-                        {break;}
198
+                    if (this.closed)                        {
199
+break;
200
+}
194
                     this.isreconnect = true;
201
                     this.isreconnect = true;
195
                     // Informs interested parties that the connection has been
202
                     // Informs interested parties that the connection has been
196
                     // interrupted.
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
                     break;
208
                     break;
201
                 case 'failed':
209
                 case 'failed':
202
                     this.room.eventEmitter.emit(
210
                     this.room.eventEmitter.emit(
228
                 if (this.drip_container.length === 0) {
236
                 if (this.drip_container.length === 0) {
229
                     // start 20ms callout
237
                     // start 20ms callout
230
                     setTimeout(() => {
238
                     setTimeout(() => {
231
-                        if (this.drip_container.length === 0) {return;}
239
+                        if (this.drip_container.length === 0) {
240
+return;
241
+}
232
                         this.sendIceCandidates(this.drip_container);
242
                         this.sendIceCandidates(this.drip_container);
233
                         this.drip_container = [];
243
                         this.drip_container = [];
234
                     }, 20);
244
                     }, 20);
658
                 }
668
                 }
659
                 $(this).find('>parameter').each(function () {
669
                 $(this).find('>parameter').each(function () {
660
                     lines += 'a=ssrc:' + ssrc + ' ' + $(this).attr('name');
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
                     lines += '\r\n';
674
                     lines += '\r\n';
664
                 });
675
                 });
665
             });
676
             });
666
             currentRemoteSdp.media.forEach(function(media, idx) {
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
                 if (!addSsrcInfo[idx]) {
681
                 if (!addSsrcInfo[idx]) {
670
                     addSsrcInfo[idx] = '';
682
                     addSsrcInfo[idx] = '';
671
                 }
683
                 }
890
                             logger.debug("Renegotiate: setting local description");
902
                             logger.debug("Renegotiate: setting local description");
891
                             this.peerconnection.setLocalDescription(
903
                             this.peerconnection.setLocalDescription(
892
                                 answer,
904
                                 answer,
893
-                                () => { resolve(); },
905
+                                () => {
906
+ resolve(); 
907
+},
894
                                 (error) => {
908
                                 (error) => {
895
                                     reject(
909
                                     reject(
896
                                         "setLocalDescription failed: " + error);
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
                         media_constraints
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
                 ssrcs.push(ssrc);
1040
                 ssrcs.push(ssrc);
1023
             });
1041
             });
1024
             currentRemoteSdp.media.forEach(function(media, idx) {
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
                 if (!removeSsrcInfo[idx]) {
1046
                 if (!removeSsrcInfo[idx]) {
1028
                     removeSsrcInfo[idx] = '';
1047
                     removeSsrcInfo[idx] = '';
1029
                 }
1048
                 }
1317
             if (errorElSel.length) {
1336
             if (errorElSel.length) {
1318
                 error.code = errorElSel.attr('code');
1337
                 error.code = errorElSel.attr('code');
1319
                 const errorReasonSel = $(errResponse).find('error :first');
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
             if (!errResponse) {
1344
             if (!errResponse) {
1430
             ssrcs.forEach(function (ssrcObj) {
1450
             ssrcs.forEach(function (ssrcObj) {
1431
                 const desc = $(jingle.tree()).find(">jingle>content[name=\"" +
1451
                 const desc = $(jingle.tree()).find(">jingle>content[name=\"" +
1432
                     ssrcObj.mtype + "\"]>description");
1452
                     ssrcObj.mtype + "\"]>description");
1433
-                if (!desc || !desc.length)
1434
-                    {return;}
1453
+                if (!desc || !desc.length)                    {
1454
+return;
1455
+}
1435
                 ssrcObj.ssrcs.forEach(function (ssrc) {
1456
                 ssrcObj.ssrcs.forEach(function (ssrc) {
1436
                     const sourceNode = desc.find(">source[ssrc=\"" +
1457
                     const sourceNode = desc.find(">source[ssrc=\"" +
1437
                         ssrc + "\"]");
1458
                         ssrc + "\"]");
1495
     fixSourceRemoveJingle(jingle) {
1516
     fixSourceRemoveJingle(jingle) {
1496
         let ssrcs = this.modifiedSSRCs["mute"];
1517
         let ssrcs = this.modifiedSSRCs["mute"];
1497
         this.modifiedSSRCs["mute"] = [];
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
                 ssrcObj.ssrcs.forEach(function (ssrc) {
1521
                 ssrcObj.ssrcs.forEach(function (ssrc) {
1501
                     const sourceNode
1522
                     const sourceNode
1502
                         = $(jingle.tree()).find(">jingle>content[name=\"" +
1523
                         = $(jingle.tree()).find(">jingle>content[name=\"" +
1513
                             group.ssrcs[0] + "\"])");
1534
                             group.ssrcs[0] + "\"])");
1514
                     groupNode.remove();
1535
                     groupNode.remove();
1515
                 });
1536
                 });
1516
-            });}
1537
+            });
1538
+}
1517
 
1539
 
1518
         ssrcs = this.modifiedSSRCs["remove"];
1540
         ssrcs = this.modifiedSSRCs["remove"];
1519
         this.modifiedSSRCs["remove"] = [];
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
                 const desc
1544
                 const desc
1523
                     = JingleSessionPC.createDescriptionNode(
1545
                     = JingleSessionPC.createDescriptionNode(
1524
                         jingle, ssrcObj.mtype);
1546
                         jingle, ssrcObj.mtype);
1548
                             "</ssrc-group>");
1570
                             "</ssrc-group>");
1549
                     }
1571
                     }
1550
                 });
1572
                 });
1551
-            });}
1573
+            });
1574
+}
1552
     }
1575
     }
1553
 
1576
 
1554
     /**
1577
     /**

+ 26
- 17
modules/xmpp/SDP.js ファイルの表示

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

+ 11
- 10
modules/xmpp/SDPDiffer.js ファイルの表示

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

+ 7
- 6
modules/xmpp/SDPUtil.js ファイルの表示

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

+ 3
- 1
modules/xmpp/SdpTransformUtil.js ファイルの表示

157
      */
157
      */
158
     containsSSRC(ssrcNumber) {
158
     containsSSRC(ssrcNumber) {
159
         return !!this._ssrcs.find(
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 ファイルの表示

55
 
55
 
56
 Recording.prototype.handleJibriPresence = function (jibri) {
56
 Recording.prototype.handleJibriPresence = function (jibri) {
57
     var attributes = jibri.attributes;
57
     var attributes = jibri.attributes;
58
-    if(!attributes)
59
-        {return;}
58
+    if(!attributes)        {
59
+return;
60
+}
60
 
61
 
61
     var newState = attributes.status;
62
     var newState = attributes.status;
62
     logger.log("Handle jibri presence : ", newState);
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
     if (newState === "undefined") {
69
     if (newState === "undefined") {
68
         this.state = Recording.status.UNAVAILABLE;
70
         this.state = Recording.status.UNAVAILABLE;
69
-    }
70
-    else if (newState === "off") {
71
+    }    else if (newState === "off") {
71
         if (!this.state
72
         if (!this.state
72
             || this.state === "undefined"
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
         this.state = newState;
80
         this.state = newState;
80
     }
81
     }
81
 
82
 
224
 
225
 
225
     // If the recorder is currently unavailable we throw an error.
226
     // If the recorder is currently unavailable we throw an error.
226
     if (oldState === Recording.status.UNAVAILABLE
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
     // If we're about to turn ON the recording we need either a streamId or
236
     // If we're about to turn ON the recording we need either a streamId or
235
     // an authentication token depending on the recording type. If we don't
237
     // an authentication token depending on the recording type. If we don't

+ 15
- 10
modules/xmpp/strophe.emuc.js ファイルの表示

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

+ 11
- 7
modules/xmpp/xmpp.js ファイルの表示

92
         }
92
         }
93
     }
93
     }
94
 
94
 
95
-    getConnection () { return this.connection; }
95
+    getConnection () {
96
+ return this.connection; 
97
+}
96
 
98
 
97
     /**
99
     /**
98
      * Receive connection status changes and handles them.
100
      * Receive connection status changes and handles them.
119
             this.connection.ping.hasPingSupport(
121
             this.connection.ping.hasPingSupport(
120
                 pingJid,
122
                 pingJid,
121
                 function (hasPing) {
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
                 }.bind(this));
129
                 }.bind(this));
127
 
130
 
128
-            if (password)
129
-                {this.authenticatedUser = true;}
131
+            if (password)                {
132
+this.authenticatedUser = true;
133
+}
130
             if (this.connection && this.connection.connected &&
134
             if (this.connection && this.connection.connected &&
131
                 Strophe.getResourceFromJid(this.connection.jid)) {
135
                 Strophe.getResourceFromJid(this.connection.jid)) {
132
                 // .connected is true while connecting?
136
                 // .connected is true while connecting?

読み込み中…
キャンセル
保存