Browse Source

[eslint] space-before-blocks

master
Lyubo Marinov 8 years ago
parent
commit
f8ab8015a2

+ 1
- 0
.eslintrc.js View File

157
         'padded-blocks': 0,
157
         'padded-blocks': 0,
158
         'quote-props': 0,
158
         'quote-props': 0,
159
         'semi': [ 'error', 'always' ],
159
         'semi': [ 'error', 'always' ],
160
+        'space-before-blocks': 2,
160
         'space-before-function-paren': [ 'error', 'never' ],
161
         'space-before-function-paren': [ 'error', 'never' ],
161
         'space-in-parens': [ 'error', 'never' ],
162
         'space-in-parens': [ 'error', 'never' ],
162
         'space-infix-ops': 2,
163
         'space-infix-ops': 2,

+ 9
- 9
JitsiConference.js View File

388
  * @param name the display name to set
388
  * @param name the display name to set
389
  */
389
  */
390
 JitsiConference.prototype.setDisplayName = function(name) {
390
 JitsiConference.prototype.setDisplayName = function(name) {
391
-    if (this.room){
391
+    if (this.room) {
392
         // remove previously set nickname
392
         // remove previously set nickname
393
         this.room.removeFromPresence("nick");
393
         this.room.removeFromPresence("nick");
394
 
394
 
411
  * Get a transcriber object for all current participants in this conference
411
  * Get a transcriber object for all current participants in this conference
412
  * @return {Transcriber} the transcriber object
412
  * @return {Transcriber} the transcriber object
413
  */
413
  */
414
-JitsiConference.prototype.getTranscriber = function(){
415
-    if (this.transcriber === undefined){
414
+JitsiConference.prototype.getTranscriber = function() {
415
+    if (this.transcriber === undefined) {
416
         this.transcriber = new Transcriber();
416
         this.transcriber = new Transcriber();
417
         // add all existing local audio tracks to the transcriber
417
         // add all existing local audio tracks to the transcriber
418
         const localAudioTracks = this.getLocalTracks(MediaType.AUDIO);
418
         const localAudioTracks = this.getLocalTracks(MediaType.AUDIO);
421
         }
421
         }
422
         // and all remote audio tracks
422
         // and all remote audio tracks
423
         const remoteAudioTracks = this.rtc.getRemoteTracks(MediaType.AUDIO);
423
         const remoteAudioTracks = this.rtc.getRemoteTracks(MediaType.AUDIO);
424
-        for (const remoteTrack of remoteAudioTracks){
424
+        for (const remoteTrack of remoteAudioTracks) {
425
             this.transcriber.addTrack(remoteTrack);
425
             this.transcriber.addTrack(remoteTrack);
426
         }
426
         }
427
     }
427
     }
935
     // Add track to JitsiParticipant.
935
     // Add track to JitsiParticipant.
936
     participant._tracks.push(track);
936
     participant._tracks.push(track);
937
 
937
 
938
-    if (this.transcriber){
938
+    if (this.transcriber) {
939
         this.transcriber.addTrack(track);
939
         this.transcriber.addTrack(track);
940
     }
940
     }
941
 
941
 
980
                 this.eventEmitter.emit(
980
                 this.eventEmitter.emit(
981
                     JitsiConferenceEvents.TRACK_REMOVED, removedTrack);
981
                     JitsiConferenceEvents.TRACK_REMOVED, removedTrack);
982
 
982
 
983
-                if (this.transcriber){
983
+                if (this.transcriber) {
984
                     this.transcriber.removeTrack(removedTrack);
984
                     this.transcriber.removeTrack(removedTrack);
985
                 }
985
                 }
986
 
986
 
1282
     if (this.room) {
1282
     if (this.room) {
1283
         return this.room.dial(number);
1283
         return this.room.dial(number);
1284
     }
1284
     }
1285
-    return new Promise(function(resolve, reject){
1285
+    return new Promise(function(resolve, reject) {
1286
         reject(new Error("The conference is not created yet!"));
1286
         reject(new Error("The conference is not created yet!"));
1287
     });
1287
     });
1288
 };
1288
 };
1294
     if (this.room) {
1294
     if (this.room) {
1295
         return this.room.hangup();
1295
         return this.room.hangup();
1296
     }
1296
     }
1297
-    return new Promise(function(resolve, reject){
1297
+    return new Promise(function(resolve, reject) {
1298
         reject(new Error("The conference is not created yet!"));
1298
         reject(new Error("The conference is not created yet!"));
1299
     });
1299
     });
1300
 };
1300
 };
1418
  * @param detailedFeedback detailed feedback from the user. Not yet used
1418
  * @param detailedFeedback detailed feedback from the user. Not yet used
1419
  */
1419
  */
1420
 JitsiConference.prototype.sendFeedback =
1420
 JitsiConference.prototype.sendFeedback =
1421
-function(overallFeedback, detailedFeedback){
1421
+function(overallFeedback, detailedFeedback) {
1422
     this.statistics.sendFeedback(overallFeedback, detailedFeedback);
1422
     this.statistics.sendFeedback(overallFeedback, detailedFeedback);
1423
 };
1423
 };
1424
 
1424
 

+ 3
- 3
JitsiConferenceEventManager.js View File

73
 
73
 
74
             this.conference.connectionIsInterrupted = false;
74
             this.conference.connectionIsInterrupted = false;
75
 
75
 
76
-            for (key in chatRoom.connectionTimes){
76
+            for (key in chatRoom.connectionTimes) {
77
                 value = chatRoom.connectionTimes[key];
77
                 value = chatRoom.connectionTimes[key];
78
                 Statistics.analytics.sendEvent('conference.' + key,
78
                 Statistics.analytics.sendEvent('conference.' + key,
79
                     {value});
79
                     {value});
80
             }
80
             }
81
-            for (key in chatRoom.xmpp.connectionTimes){
81
+            for (key in chatRoom.xmpp.connectionTimes) {
82
                 value = chatRoom.xmpp.connectionTimes[key];
82
                 value = chatRoom.xmpp.connectionTimes[key];
83
                 Statistics.analytics.sendEvent('xmpp.' + key,
83
                 Statistics.analytics.sendEvent('xmpp.' + key,
84
                     {value});
84
                     {value});
112
         JitsiConferenceEvents.CONFERENCE_FAILED,
112
         JitsiConferenceEvents.CONFERENCE_FAILED,
113
         JitsiConferenceErrors.VIDEOBRIDGE_NOT_AVAILABLE);
113
         JitsiConferenceErrors.VIDEOBRIDGE_NOT_AVAILABLE);
114
     chatRoom.addListener(XMPPEvents.BRIDGE_DOWN,
114
     chatRoom.addListener(XMPPEvents.BRIDGE_DOWN,
115
-        function(){
115
+        function() {
116
             Statistics.analytics.sendEvent('conference.bridgeDown');
116
             Statistics.analytics.sendEvent('conference.bridgeDown');
117
         });
117
         });
118
 
118
 

+ 2
- 2
JitsiMeetJS.js View File

244
                     for(let i = 0; i < tracks.length; i++) {
244
                     for(let i = 0; i < tracks.length; i++) {
245
                         const track = tracks[i];
245
                         const track = tracks[i];
246
                         var mStream = track.getOriginalStream();
246
                         var mStream = track.getOriginalStream();
247
-                        if(track.getType() === MediaType.AUDIO){
247
+                        if(track.getType() === MediaType.AUDIO) {
248
                             Statistics.startLocalStats(mStream,
248
                             Statistics.startLocalStats(mStream,
249
                                 track.setAudioLevel.bind(track));
249
                                 track.setAudioLevel.bind(track));
250
                             track.addEventListener(
250
                             track.addEventListener(
251
                                 JitsiTrackEvents.LOCAL_TRACK_STOPPED,
251
                                 JitsiTrackEvents.LOCAL_TRACK_STOPPED,
252
-                                function(){
252
+                                function() {
253
                                     Statistics.stopLocalStats(mStream);
253
                                     Statistics.stopLocalStats(mStream);
254
                                 });
254
                                 });
255
                         }
255
                         }

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

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){
22
+function onLocalTracks(tracks) {
23
     localTracks = tracks;
23
     localTracks = tracks;
24
     for(var i = 0; i < localTracks.length; i++) {
24
     for(var i = 0; i < localTracks.length; i++) {
25
         localTracks[i].addEventListener(JitsiMeetJS.events.track.TRACK_AUDIO_LEVEL_CHANGED,
25
         localTracks[i].addEventListener(JitsiMeetJS.events.track.TRACK_AUDIO_LEVEL_CHANGED,
114
 /**
114
 /**
115
  * That function is called when connection is established successfully
115
  * That function is called when connection is established successfully
116
  */
116
  */
117
-function onConnectionSuccess(){
117
+function onConnectionSuccess() {
118
     room = connection.initJitsiConference("conference", confOptions);
118
     room = connection.initJitsiConference("conference", confOptions);
119
     room.on(JitsiMeetJS.events.conference.TRACK_ADDED, onRemoteTrack);
119
     room.on(JitsiMeetJS.events.conference.TRACK_ADDED, onRemoteTrack);
120
     room.on(JitsiMeetJS.events.conference.TRACK_REMOVED, function(track) {
120
     room.on(JitsiMeetJS.events.conference.TRACK_REMOVED, function(track) {
121
         console.log("track removed!!!" + track);
121
         console.log("track removed!!!" + track);
122
     });
122
     });
123
     room.on(JitsiMeetJS.events.conference.CONFERENCE_JOINED, onConferenceJoined);
123
     room.on(JitsiMeetJS.events.conference.CONFERENCE_JOINED, onConferenceJoined);
124
-    room.on(JitsiMeetJS.events.conference.USER_JOINED, function(id){
124
+    room.on(JitsiMeetJS.events.conference.USER_JOINED, function(id) {
125
         console.log("user join");remoteTracks[id] = [];
125
         console.log("user join");remoteTracks[id] = [];
126
     });
126
     });
127
     room.on(JitsiMeetJS.events.conference.USER_LEFT, onUserLeft);
127
     room.on(JitsiMeetJS.events.conference.USER_LEFT, onUserLeft);
132
         console.log(userID + " - " + displayName);
132
         console.log(userID + " - " + displayName);
133
     });
133
     });
134
     room.on(JitsiMeetJS.events.conference.TRACK_AUDIO_LEVEL_CHANGED,
134
     room.on(JitsiMeetJS.events.conference.TRACK_AUDIO_LEVEL_CHANGED,
135
-      function(userID, audioLevel){
135
+      function(userID, audioLevel) {
136
           console.log(userID + " - " + audioLevel);
136
           console.log(userID + " - " + audioLevel);
137
       });
137
       });
138
     room.on(JitsiMeetJS.events.conference.RECORDER_STATE_CHANGED, function() {
138
     room.on(JitsiMeetJS.events.conference.RECORDER_STATE_CHANGED, function() {
165
 /**
165
 /**
166
  * This function is called when we disconnect.
166
  * This function is called when we disconnect.
167
  */
167
  */
168
-function disconnect(){
168
+function disconnect() {
169
     console.log("disconnect!");
169
     console.log("disconnect!");
170
     connection.removeEventListener(JitsiMeetJS.events.connection.CONNECTION_ESTABLISHED, onConnectionSuccess);
170
     connection.removeEventListener(JitsiMeetJS.events.connection.CONNECTION_ESTABLISHED, onConnectionSuccess);
171
     connection.removeEventListener(JitsiMeetJS.events.connection.CONNECTION_FAILED, onConnectionFailed);
171
     connection.removeEventListener(JitsiMeetJS.events.connection.CONNECTION_FAILED, onConnectionFailed);
239
     // The URL to the Firefox extension for desktop sharing.
239
     // The URL to the Firefox extension for desktop sharing.
240
     desktopSharingFirefoxExtensionURL: null
240
     desktopSharingFirefoxExtensionURL: null
241
 };
241
 };
242
-JitsiMeetJS.init(initOptions).then(function(){
242
+JitsiMeetJS.init(initOptions).then(function() {
243
     connection = new JitsiMeetJS.JitsiConnection(null, null, options);
243
     connection = new JitsiMeetJS.JitsiConnection(null, null, options);
244
 
244
 
245
     connection.addEventListener(JitsiMeetJS.events.connection.CONNECTION_ESTABLISHED, onConnectionSuccess);
245
     connection.addEventListener(JitsiMeetJS.events.connection.CONNECTION_ESTABLISHED, onConnectionSuccess);

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

168
  * Closes all currently opened data channels.
168
  * Closes all currently opened data channels.
169
  */
169
  */
170
 DataChannels.prototype.closeAllChannels = function() {
170
 DataChannels.prototype.closeAllChannels = function() {
171
-    this._dataChannels.forEach(function(dc){
171
+    this._dataChannels.forEach(function(dc) {
172
         // the DC will be removed from the array on 'onclose' event
172
         // the DC will be removed from the array on 'onclose' event
173
         dc.close();
173
         dc.close();
174
     });
174
     });

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

448
     var self = this;
448
     var self = this;
449
     var promise = Promise.resolve();
449
     var promise = Promise.resolve();
450
 
450
 
451
-    if (this.conference){
451
+    if (this.conference) {
452
         promise = this.conference.removeTrack(this);
452
         promise = this.conference.removeTrack(this);
453
     }
453
     }
454
 
454
 
562
         = this.conference ? this.conference.getConnectionState() : null;
562
         = this.conference ? this.conference.getConnectionState() : null;
563
     if(this._testByteSent && "connected" === iceConnectionState) {
563
     if(this._testByteSent && "connected" === iceConnectionState) {
564
         setTimeout(function() {
564
         setTimeout(function() {
565
-            if(this._bytesSent <= 0){
565
+            if(this._bytesSent <= 0) {
566
                 // we are not receiving anything from the microphone
566
                 // we are not receiving anything from the microphone
567
                 this._fireNoDataFromSourceEvent();
567
                 this._fireNoDataFromSourceEvent();
568
             }
568
             }

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

67
  * @param ssrc the SSRC of this track if known
67
  * @param ssrc the SSRC of this track if known
68
  */
68
  */
69
 function JitsiTrack(conference, stream, track, streamInactiveHandler, trackMediaType,
69
 function JitsiTrack(conference, stream, track, streamInactiveHandler, trackMediaType,
70
-                    videoType, ssrc){
70
+                    videoType, ssrc) {
71
     /**
71
     /**
72
      * Array with the HTML elements that are displaying the streams.
72
      * Array with the HTML elements that are displaying the streams.
73
      * @type {Array}
73
      * @type {Array}

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

18
 function createLocalTracks(tracksInfo, options) {
18
 function createLocalTracks(tracksInfo, options) {
19
     var newTracks = [];
19
     var newTracks = [];
20
     var deviceId = null;
20
     var deviceId = null;
21
-    tracksInfo.forEach(function(trackInfo){
21
+    tracksInfo.forEach(function(trackInfo) {
22
         if (trackInfo.mediaType === MediaType.AUDIO) {
22
         if (trackInfo.mediaType === MediaType.AUDIO) {
23
             deviceId = options.micDeviceId;
23
             deviceId = options.micDeviceId;
24
-        } else if (trackInfo.videoType === VideoType.CAMERA){
24
+        } else if (trackInfo.videoType === VideoType.CAMERA) {
25
             deviceId = options.cameraDeviceId;
25
             deviceId = options.cameraDeviceId;
26
         }
26
         }
27
         var localTrack
27
         var localTrack
366
      */
366
      */
367
     setAudioMute(value) {
367
     setAudioMute(value) {
368
         const mutePromises = [];
368
         const mutePromises = [];
369
-        this.getLocalTracks(MediaType.AUDIO).forEach(function(audioTrack){
369
+        this.getLocalTracks(MediaType.AUDIO).forEach(function(audioTrack) {
370
             // this is a Promise
370
             // this is a Promise
371
             mutePromises.push(value ? audioTrack.mute() : audioTrack.unmute());
371
             mutePromises.push(value ? audioTrack.mute() : audioTrack.unmute());
372
         });
372
         });

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

997
 
997
 
998
             options.devices = options.devices || ['audio', 'video'];
998
             options.devices = options.devices || ['audio', 'video'];
999
             if(!screenObtainer.isSupported()
999
             if(!screenObtainer.isSupported()
1000
-                && options.devices.indexOf("desktop") !== -1){
1000
+                && options.devices.indexOf("desktop") !== -1) {
1001
                 reject(new Error("Desktop sharing is not supported!"));
1001
                 reject(new Error("Desktop sharing is not supported!"));
1002
             }
1002
             }
1003
             if (RTCBrowserType.isFirefox()
1003
             if (RTCBrowserType.isFirefox()
1018
                     "video": GUM.bind(self, ["video"])
1018
                     "video": GUM.bind(self, ["video"])
1019
                 };
1019
                 };
1020
 
1020
 
1021
-                if(screenObtainer.isSupported()){
1021
+                if(screenObtainer.isSupported()) {
1022
                     deviceGUM["desktop"] = screenObtainer.obtainStream.bind(
1022
                     deviceGUM["desktop"] = screenObtainer.obtainStream.bind(
1023
                         screenObtainer,
1023
                         screenObtainer,
1024
                         dsOptions);
1024
                         dsOptions);

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

151
         } else if (RTCBrowserType.isFirefox()) {
151
         } else if (RTCBrowserType.isFirefox()) {
152
             if (options.desktopSharingFirefoxDisabled) {
152
             if (options.desktopSharingFirefoxDisabled) {
153
                 obtainDesktopStream = null;
153
                 obtainDesktopStream = null;
154
-            } else if (window.location.protocol === "http:"){
154
+            } else if (window.location.protocol === "http:") {
155
                 logger.log("Screen sharing is not supported over HTTP. " +
155
                 logger.log("Screen sharing is not supported over HTTP. " +
156
                     "Use of HTTPS is required.");
156
                     "Use of HTTPS is required.");
157
                 obtainDesktopStream = null;
157
                 obtainDesktopStream = null;
333
  * @param options supports "desktopSharingChromeExtId"
333
  * @param options supports "desktopSharingChromeExtId"
334
  * @returns {string}
334
  * @returns {string}
335
  */
335
  */
336
-function getWebStoreInstallUrl(options){
336
+function getWebStoreInstallUrl(options) {
337
     return "https://chrome.google.com/webstore/detail/" +
337
     return "https://chrome.google.com/webstore/detail/" +
338
         options.desktopSharingChromeExtId;
338
         options.desktopSharingChromeExtId;
339
 }
339
 }
439
  * website of published extension.
439
  * website of published extension.
440
  * @param options supports "desktopSharingChromeExtId"
440
  * @param options supports "desktopSharingChromeExtId"
441
  */
441
  */
442
-function initInlineInstalls(options){
442
+function initInlineInstalls(options) {
443
     if($("link[rel=chrome-webstore-item]").length === 0) {
443
     if($("link[rel=chrome-webstore-item]").length === 0) {
444
         $("head").append("<link rel=\"chrome-webstore-item\">");
444
         $("head").append("<link rel=\"chrome-webstore-item\">");
445
     }
445
     }

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

267
 
267
 
268
     const remoteSDP = new SDP(this.remoteDescription.sdp);
268
     const remoteSDP = new SDP(this.remoteDescription.sdp);
269
     const mediaLines = remoteSDP.media.filter(
269
     const mediaLines = remoteSDP.media.filter(
270
-        function(mediaLines){
270
+        function(mediaLines) {
271
             return mediaLines.startsWith("m=" + mediaType);
271
             return mediaLines.startsWith("m=" + mediaType);
272
         });
272
         });
273
     if (!mediaLines.length) {
273
     if (!mediaLines.length) {
535
 
535
 
536
             if (Array.isArray(mLine.ssrcs)) {
536
             if (Array.isArray(mLine.ssrcs)) {
537
                 var i;
537
                 var i;
538
-                for (i = 0; i < mLine.ssrcs.length; i++){
538
+                for (i = 0; i < mLine.ssrcs.length; i++) {
539
                     if (typeof mLine.ssrcs[i] === 'object'
539
                     if (typeof mLine.ssrcs[i] === 'object'
540
                         && typeof mLine.ssrcs[i].id !== 'undefined'
540
                         && typeof mLine.ssrcs[i].id !== 'undefined'
541
                         && firstSsrcs.indexOf(mLine.ssrcs[i].id) >= 0) {
541
                         && firstSsrcs.indexOf(mLine.ssrcs[i].id) >= 0) {
544
                     }
544
                     }
545
                 }
545
                 }
546
 
546
 
547
-                for (i = 0; i < mLine.ssrcs.length; i++){
547
+                for (i = 0; i < mLine.ssrcs.length; i++) {
548
                     if (typeof mLine.ssrcs[i] !== 'undefined') {
548
                     if (typeof mLine.ssrcs[i] !== 'undefined') {
549
                         newSsrcLines.push(mLine.ssrcs[i]);
549
                         newSsrcLines.push(mLine.ssrcs[i]);
550
                     }
550
                     }

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

379
  * @param {RTCPeerConnection} pc connection on which failure occured.
379
  * @param {RTCPeerConnection} pc connection on which failure occured.
380
  * @param {CallStats} cs callstats instance related to the error (optional)
380
  * @param {CallStats} cs callstats instance related to the error (optional)
381
  */
381
  */
382
-CallStats.prototype.sendIceConnectionFailedEvent = _try_catch(function(pc, cs){
382
+CallStats.prototype.sendIceConnectionFailedEvent = _try_catch(function(pc, cs) {
383
     CallStats._reportError.call(
383
     CallStats._reportError.call(
384
         cs, wrtcFuncNames.iceConnectionFailure, null, pc);
384
         cs, wrtcFuncNames.iceConnectionFailure, null, pc);
385
 });
385
 });

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

406
                     "upload": Math.round(sendBandwidth / 1000)
406
                     "upload": Math.round(sendBandwidth / 1000)
407
                 };
407
                 };
408
             }
408
             }
409
-        } catch(e){/* not supported*/}
409
+        } catch(e) {/* not supported*/}
410
 
410
 
411
         if(now.type == 'googCandidatePair') {
411
         if(now.type == 'googCandidatePair') {
412
             var ip, type, localip, active;
412
             var ip, type, localip, active;
415
                 type = getStatValue(now, "transportType");
415
                 type = getStatValue(now, "transportType");
416
                 localip = getStatValue(now, "localAddress");
416
                 localip = getStatValue(now, "localAddress");
417
                 active = getStatValue(now, "activeConnection");
417
                 active = getStatValue(now, "activeConnection");
418
-            } catch(e){/* not supported*/}
418
+            } catch(e) {/* not supported*/}
419
             if(!ip || !type || !localip || active != "true") {
419
             if(!ip || !type || !localip || active != "true") {
420
                 continue;
420
                 continue;
421
             }
421
             }
501
         if(typeof nowBytesTransmitted === "number" ||
501
         if(typeof nowBytesTransmitted === "number" ||
502
             typeof nowBytesTransmitted === "string") {
502
             typeof nowBytesTransmitted === "string") {
503
             nowBytesTransmitted = Number(nowBytesTransmitted);
503
             nowBytesTransmitted = Number(nowBytesTransmitted);
504
-            if(!isNaN(nowBytesTransmitted)){
504
+            if(!isNaN(nowBytesTransmitted)) {
505
                 byteSentStats[ssrc] = nowBytesTransmitted;
505
                 byteSentStats[ssrc] = nowBytesTransmitted;
506
                 if (nowBytesTransmitted > 0) {
506
                 if (nowBytesTransmitted > 0) {
507
                     bytesSent = nowBytesTransmitted -
507
                     bytesSent = nowBytesTransmitted -
536
                 resolution.height = height;
536
                 resolution.height = height;
537
                 resolution.width = width;
537
                 resolution.width = width;
538
             }
538
             }
539
-        } catch(e){/* not supported*/}
539
+        } catch(e) {/* not supported*/}
540
 
540
 
541
         if (resolution.height && resolution.width) {
541
         if (resolution.height && resolution.width) {
542
             ssrcStats.setResolution(resolution);
542
             ssrcStats.setResolution(resolution);

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

191
     }
191
     }
192
 
192
 
193
     for(var i = 0; i < Statistics.localStats.length; i++) {
193
     for(var i = 0; i < Statistics.localStats.length; i++) {
194
-        if(Statistics.localStats[i].stream === stream){
194
+        if(Statistics.localStats[i].stream === stream) {
195
             var localStats = Statistics.localStats.splice(i, 1);
195
             var localStats = Statistics.localStats.splice(i, 1);
196
             localStats[0].stop();
196
             localStats[0].stop();
197
             break;
197
             break;

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

13
  * single JitsiTrack (either remote or local)
13
  * single JitsiTrack (either remote or local)
14
  * @param track The JitsiTrack the object is going to hold
14
  * @param track The JitsiTrack the object is going to hold
15
  */
15
  */
16
-var TrackRecorder = function(track){
16
+var TrackRecorder = function(track) {
17
     // The JitsiTrack holding the stream
17
     // The JitsiTrack holding the stream
18
     this.track = track;
18
     this.track = track;
19
     // The MediaRecorder recording the stream
19
     // The MediaRecorder recording the stream
47
  * This will also try to update the name
47
  * This will also try to update the name
48
  * @param trackRecorder the TrackRecorder to stop
48
  * @param trackRecorder the TrackRecorder to stop
49
  */
49
  */
50
-function stopRecorder(trackRecorder){
50
+function stopRecorder(trackRecorder) {
51
     if(trackRecorder.recorder === undefined) {
51
     if(trackRecorder.recorder === undefined) {
52
         throw new Error("Passed an object to stopRecorder which is not a " +
52
         throw new Error("Passed an object to stopRecorder which is not a " +
53
             "TrackRecorder object");
53
             "TrackRecorder object");
65
     // Create a new stream which only holds the audio track
65
     // Create a new stream which only holds the audio track
66
     var originalStream = trackRecorder.track.getOriginalStream();
66
     var originalStream = trackRecorder.track.getOriginalStream();
67
     var stream = createEmptyStream();
67
     var stream = createEmptyStream();
68
-    originalStream.getAudioTracks().forEach(function(track){
68
+    originalStream.getAudioTracks().forEach(function(track) {
69
         stream.addTrack(track);
69
         stream.addTrack(track);
70
     });
70
     });
71
     // Create the MediaRecorder
71
     // Create the MediaRecorder
105
  * @param jitsiConference the jitsiConference which this object
105
  * @param jitsiConference the jitsiConference which this object
106
  * is going to record
106
  * is going to record
107
  */
107
  */
108
-var audioRecorder = function(jitsiConference){
108
+var audioRecorder = function(jitsiConference) {
109
     // array of TrackRecorders, where each trackRecorder
109
     // array of TrackRecorders, where each trackRecorder
110
     // holds the JitsiTrack, MediaRecorder and recorder data
110
     // holds the JitsiTrack, MediaRecorder and recorder data
111
     this.recorders = [];
111
     this.recorders = [];
140
         this.updateNames();
140
         this.updateNames();
141
         // If we're already recording, immediately start recording this new
141
         // If we're already recording, immediately start recording this new
142
         // track.
142
         // track.
143
-        if(this.isRecording){
143
+        if(this.isRecording) {
144
             startRecorder(trackRecorder);
144
             startRecorder(trackRecorder);
145
         }
145
         }
146
     }
146
     }
156
  *
156
  *
157
  * @param {JitsiTrack} track the JitsiTrack to remove from the recording session
157
  * @param {JitsiTrack} track the JitsiTrack to remove from the recording session
158
  */
158
  */
159
-audioRecorder.prototype.removeTrack = function(track){
160
-    if(track.isVideoTrack()){
159
+audioRecorder.prototype.removeTrack = function(track) {
160
+    if(track.isVideoTrack()) {
161
         return;
161
         return;
162
     }
162
     }
163
 
163
 
164
     var array = this.recorders;
164
     var array = this.recorders;
165
     var i;
165
     var i;
166
     for(i = 0; i < array.length; i++) {
166
     for(i = 0; i < array.length; i++) {
167
-        if(array[i].track.getParticipantId() === track.getParticipantId()){
167
+        if(array[i].track.getParticipantId() === track.getParticipantId()) {
168
             var recorderToRemove = array[i];
168
             var recorderToRemove = array[i];
169
-            if(this.isRecording){
169
+            if(this.isRecording) {
170
                 stopRecorder(recorderToRemove);
170
                 stopRecorder(recorderToRemove);
171
             } else {
171
             } else {
172
                 // remove the TrackRecorder from the array
172
                 // remove the TrackRecorder from the array
184
  * If it hasn't changed,it will keep the exiting name. If it changes to a
184
  * If it hasn't changed,it will keep the exiting name. If it changes to a
185
  * undefined value, the old value will also be kept.
185
  * undefined value, the old value will also be kept.
186
  */
186
  */
187
-audioRecorder.prototype.updateNames = function(){
187
+audioRecorder.prototype.updateNames = function() {
188
     var conference = this.jitsiConference;
188
     var conference = this.jitsiConference;
189
-    this.recorders.forEach(function(trackRecorder){
190
-        if(trackRecorder.track.isLocal()){
189
+    this.recorders.forEach(function(trackRecorder) {
190
+        if(trackRecorder.track.isLocal()) {
191
             trackRecorder.name = "the transcriber";
191
             trackRecorder.name = "the transcriber";
192
         } else {
192
         } else {
193
             var id = trackRecorder.track.getParticipantId();
193
             var id = trackRecorder.track.getParticipantId();
211
     // conference, that track can instantly start recording as well
211
     // conference, that track can instantly start recording as well
212
     this.isRecording = true;
212
     this.isRecording = true;
213
     // start all the mediaRecorders
213
     // start all the mediaRecorders
214
-    this.recorders.forEach(function(trackRecorder){
214
+    this.recorders.forEach(function(trackRecorder) {
215
         startRecorder(trackRecorder);
215
         startRecorder(trackRecorder);
216
     });
216
     });
217
     // log that recording has started
217
     // log that recording has started
226
     // set the boolean flag to false
226
     // set the boolean flag to false
227
     this.isRecording = false;
227
     this.isRecording = false;
228
     // stop all recorders
228
     // stop all recorders
229
-    this.recorders.forEach(function(trackRecorder){
229
+    this.recorders.forEach(function(trackRecorder) {
230
         stopRecorder(trackRecorder);
230
         stopRecorder(trackRecorder);
231
     });
231
     });
232
     console.log("stopped recording");
232
     console.log("stopped recording");

+ 1
- 1
modules/transcription/recordingResult.js View File

8
  * @param wordArray the recorder audio stream transcribed as an array of Word
8
  * @param wordArray the recorder audio stream transcribed as an array of Word
9
  *                  objects
9
  *                  objects
10
  */
10
  */
11
-var RecordingResult = function(blob, name, startTime, wordArray){
11
+var RecordingResult = function(blob, name, startTime, wordArray) {
12
     this.blob = blob;
12
     this.blob = blob;
13
     this.name = name;
13
     this.name = name;
14
     this.startTime = startTime;
14
     this.startTime = startTime;

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

48
  * purposes
48
  * purposes
49
  */
49
  */
50
 transcriber.prototype.start = function start() {
50
 transcriber.prototype.start = function start() {
51
-    if(this.state !== BEFORE_STATE){
51
+    if(this.state !== BEFORE_STATE) {
52
         throw new Error("The transcription can only start when it's in the" +
52
         throw new Error("The transcription can only start when it's in the" +
53
             "\"" + BEFORE_STATE + "\" state. It's currently in the " +
53
             "\"" + BEFORE_STATE + "\" state. It's currently in the " +
54
             "\"" + this.state + "\" state");
54
             "\"" + this.state + "\" state");
65
  * @param callback a callback which will receive the transcription
65
  * @param callback a callback which will receive the transcription
66
  */
66
  */
67
 transcriber.prototype.stop = function stop(callback) {
67
 transcriber.prototype.stop = function stop(callback) {
68
-    if(this.state !== RECORDING_STATE){
68
+    if(this.state !== RECORDING_STATE) {
69
         throw new Error("The transcription can only stop when it's in the" +
69
         throw new Error("The transcription can only stop when it's in the" +
70
             "\"" + RECORDING_STATE + "\" state. It's currently in the " +
70
             "\"" + RECORDING_STATE + "\" state. It's currently in the " +
71
             "\"" + this.state + "\" state");
71
             "\"" + this.state + "\" state");
77
     var t = this;
77
     var t = this;
78
 
78
 
79
     var callBack = blobCallBack.bind(this);
79
     var callBack = blobCallBack.bind(this);
80
-    this.audioRecorder.getRecordingResults().forEach(function(recordingResult){
80
+    this.audioRecorder.getRecordingResults().forEach(function(recordingResult) {
81
         t.transcriptionService.send(recordingResult, callBack);
81
         t.transcriptionService.send(recordingResult, callBack);
82
         t.counter++;
82
         t.counter++;
83
     });
83
     });
97
  * @param {RecordingResult} answer a RecordingResult object with a defined
97
  * @param {RecordingResult} answer a RecordingResult object with a defined
98
  * WordArray
98
  * WordArray
99
  */
99
  */
100
-var blobCallBack = function(answer){
100
+var blobCallBack = function(answer) {
101
     console.log("retrieved an answer from the transcription service. The" +
101
     console.log("retrieved an answer from the transcription service. The" +
102
         " answer has an array of length: " + answer.wordArray.length);
102
         " answer has an array of length: " + answer.wordArray.length);
103
     // first add the offset between the start of the transcription and
103
     // first add the offset between the start of the transcription and
135
  * this method will check if the counter is zero. If it is, it will call
135
  * this method will check if the counter is zero. If it is, it will call
136
  * the merging method
136
  * the merging method
137
  */
137
  */
138
-transcriber.prototype.maybeMerge = function(){
139
-    if(this.state === TRANSCRIBING_STATE && this.counter === 0){
138
+transcriber.prototype.maybeMerge = function() {
139
+    if(this.state === TRANSCRIBING_STATE && this.counter === 0) {
140
         // make sure to include the events in the result arrays before
140
         // make sure to include the events in the result arrays before
141
         // merging starts
141
         // merging starts
142
         this.merge();
142
         this.merge();
163
     hasPopulatedArrays(arrays);
163
     hasPopulatedArrays(arrays);
164
 
164
 
165
     // populate all the potential Words for a first time
165
     // populate all the potential Words for a first time
166
-    arrays.forEach(function(array){
166
+    arrays.forEach(function(array) {
167
         pushWordToSortedArray(potentialWords, array);
167
         pushWordToSortedArray(potentialWords, array);
168
     });
168
     });
169
 
169
 
171
     var lowestWordArray;
171
     var lowestWordArray;
172
     var wordToAdd;
172
     var wordToAdd;
173
     var foundSmaller;
173
     var foundSmaller;
174
-    while(hasPopulatedArrays(arrays)){
174
+    while(hasPopulatedArrays(arrays)) {
175
         // first select the lowest array;
175
         // first select the lowest array;
176
         lowestWordArray = arrays[0];
176
         lowestWordArray = arrays[0];
177
-        arrays.forEach(function(wordArray){
178
-            if(wordArray[0].begin < lowestWordArray[0].begin){
177
+        arrays.forEach(function(wordArray) {
178
+            if(wordArray[0].begin < lowestWordArray[0].begin) {
179
                 lowestWordArray = wordArray;
179
                 lowestWordArray = wordArray;
180
             }
180
             }
181
         });
181
         });
185
 
185
 
186
         // keep going until a word in another array has a smaller time
186
         // keep going until a word in another array has a smaller time
187
         // or the array is empty
187
         // or the array is empty
188
-        while(!foundSmaller && lowestWordArray.length > 0){
189
-            arrays.forEach(function(wordArray){
190
-                if(wordArray[0].begin < lowestWordArray[0].begin){
188
+        while(!foundSmaller && lowestWordArray.length > 0) {
189
+            arrays.forEach(function(wordArray) {
190
+                if(wordArray[0].begin < lowestWordArray[0].begin) {
191
                     foundSmaller = true;
191
                     foundSmaller = true;
192
                 }
192
                 }
193
             });
193
             });
194
             // add next word if no smaller time has been found
194
             // add next word if no smaller time has been found
195
-            if(!foundSmaller){
195
+            if(!foundSmaller) {
196
                 wordToAdd = lowestWordArray.shift();
196
                 wordToAdd = lowestWordArray.shift();
197
                 this.updateTranscription(wordToAdd, null);
197
                 this.updateTranscription(wordToAdd, null);
198
             }
198
             }
202
 
202
 
203
     // set the state to finished and do the necessary left-over tasks
203
     // set the state to finished and do the necessary left-over tasks
204
     this.state = FINISHED_STATE;
204
     this.state = FINISHED_STATE;
205
-    if(this.callback){
205
+    if(this.callback) {
206
         this.callback(this.transcription);
206
         this.callback(this.transcription);
207
     }
207
     }
208
 };
208
 };
213
  * @param {Word} word the Word object holding the word to append
213
  * @param {Word} word the Word object holding the word to append
214
  * @param {String|null} name the name of a new speaker. Null if not applicable
214
  * @param {String|null} name the name of a new speaker. Null if not applicable
215
  */
215
  */
216
-transcriber.prototype.updateTranscription = function(word, name){
217
-    if(name !== undefined && name !== null){
216
+transcriber.prototype.updateTranscription = function(word, name) {
217
+    if(name !== undefined && name !== null) {
218
         this.transcription += "\n" + name + ":";
218
         this.transcription += "\n" + name + ":";
219
         this.lineLength = name.length + 1; // +1 for the semi-colon
219
         this.lineLength = name.length + 1; // +1 for the semi-colon
220
     }
220
     }
221
-    if(this.lineLength + word.word.length > MAXIMUM_SENTENCE_LENGTH){
221
+    if(this.lineLength + word.word.length > MAXIMUM_SENTENCE_LENGTH) {
222
         this.transcription += "\n    ";
222
         this.transcription += "\n    ";
223
         this.lineLength = 4; // because of the 4 spaces after the new line
223
         this.lineLength = 4; // because of the 4 spaces after the new line
224
     }
224
     }
234
  * @param {Array<Array>} twoDimensionalArray the array to check
234
  * @param {Array<Array>} twoDimensionalArray the array to check
235
  * @returns {boolean} true if any non-zero arrays inside, otherwise false
235
  * @returns {boolean} true if any non-zero arrays inside, otherwise false
236
  */
236
  */
237
-var hasPopulatedArrays = function(twoDimensionalArray){
237
+var hasPopulatedArrays = function(twoDimensionalArray) {
238
     var i;
238
     var i;
239
-    for(i = 0; i < twoDimensionalArray.length; i++){
240
-        if(twoDimensionalArray[i].length === 0){
239
+    for(i = 0; i < twoDimensionalArray.length; i++) {
240
+        if(twoDimensionalArray[i].length === 0) {
241
             twoDimensionalArray.splice(i, 1);
241
             twoDimensionalArray.splice(i, 1);
242
         }
242
         }
243
     }
243
     }
252
  * @param {Array<Word>} array the sorted array to push to
252
  * @param {Array<Word>} array the sorted array to push to
253
  * @param {Word} word the word to push into the array
253
  * @param {Word} word the word to push into the array
254
  */
254
  */
255
-var pushWordToSortedArray = function(array, word){
255
+var pushWordToSortedArray = function(array, word) {
256
     if(array.length === 0) {
256
     if(array.length === 0) {
257
         array.push(word);
257
         array.push(word);
258
     } else{
258
     } else{
259
-        if(array[array.length - 1].begin <= word.begin){
259
+        if(array[array.length - 1].begin <= word.begin) {
260
             array.push(word);
260
             array.push(word);
261
             return;
261
             return;
262
         }
262
         }
263
         var i;
263
         var i;
264
-        for(i = 0; i < array.length; i++){
265
-            if(word.begin < array[i].begin){
264
+        for(i = 0; i < array.length; i++) {
265
+            if(word.begin < array[i].begin) {
266
                 array.splice(i, 0, word);
266
                 array.splice(i, 0, word);
267
                 return;
267
                 return;
268
             }
268
             }
277
  * audiostream, it will not be added by the audioRecorder
277
  * audiostream, it will not be added by the audioRecorder
278
  * @param {JitsiTrack} track the track to give to the audioRecorder
278
  * @param {JitsiTrack} track the track to give to the audioRecorder
279
  */
279
  */
280
-transcriber.prototype.addTrack = function(track){
280
+transcriber.prototype.addTrack = function(track) {
281
     this.audioRecorder.addTrack(track);
281
     this.audioRecorder.addTrack(track);
282
 };
282
 };
283
 
283
 
285
  * Remove the given track from the auioRecorder
285
  * Remove the given track from the auioRecorder
286
  * @param track
286
  * @param track
287
  */
287
  */
288
-transcriber.prototype.removeTrack = function(track){
288
+transcriber.prototype.removeTrack = function(track) {
289
     this.audioRecorder.removeTrack(track);
289
     this.audioRecorder.removeTrack(track);
290
 };
290
 };
291
 
291
 
294
  * when it's not done yet
294
  * when it's not done yet
295
  * @returns {String} the transcription as a String
295
  * @returns {String} the transcription as a String
296
  */
296
  */
297
-transcriber.prototype.getTranscription = function(){
298
-    if(this.state !== FINISHED_STATE){
297
+transcriber.prototype.getTranscription = function() {
298
+    if(this.state !== FINISHED_STATE) {
299
         throw new Error("The transcription can only be retrieved when it's in" +
299
         throw new Error("The transcription can only be retrieved when it's in" +
300
             " the\"" + FINISHED_STATE + "\" state. It's currently in the " +
300
             " the\"" + FINISHED_STATE + "\" state. It's currently in the " +
301
             "\"" + this.state + "\" state");
301
             "\"" + this.state + "\" state");
306
 /**
306
 /**
307
  * Returns the current state of the transcription process
307
  * Returns the current state of the transcription process
308
  */
308
  */
309
-transcriber.prototype.getState = function(){
309
+transcriber.prototype.getState = function() {
310
     return this.state;
310
     return this.state;
311
 };
311
 };
312
 
312
 

+ 1
- 1
modules/transcription/transcriberHolder.js View File

8
 var transcriberHolder = {
8
 var transcriberHolder = {
9
     transcribers : [],
9
     transcribers : [],
10
 
10
 
11
-    add(transcriber){
11
+    add(transcriber) {
12
         transcriberHolder.transcribers.push(transcriber);
12
         transcriberHolder.transcribers.push(transcriber);
13
     }
13
     }
14
 };
14
 };

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

16
  * @param {Function} callback  which will retrieve the a RecordingResult with
16
  * @param {Function} callback  which will retrieve the a RecordingResult with
17
  *        the answer as a WordArray
17
  *        the answer as a WordArray
18
  */
18
  */
19
-TranscriptionService.prototype.send = function send(recordingResult, callback){
19
+TranscriptionService.prototype.send = function send(recordingResult, callback) {
20
     var t = this;
20
     var t = this;
21
-    this.sendRequest(recordingResult.blob, function(response){
22
-        if(!t.verify(response)){
21
+    this.sendRequest(recordingResult.blob, function(response) {
22
+        if(!t.verify(response)) {
23
             console.log("the retrieved response from the server" +
23
             console.log("the retrieved response from the server" +
24
                    " is not valid!");
24
                    " is not valid!");
25
             recordingResult.wordArray = [];
25
             recordingResult.wordArray = [];
61
  * @return {Array<Word>} an array of Word objects
61
  * @return {Array<Word>} an array of Word objects
62
  */
62
  */
63
 // eslint-disable-next-line no-unused-vars
63
 // eslint-disable-next-line no-unused-vars
64
-TranscriptionService.prototype.formatResponse = function(response){
64
+TranscriptionService.prototype.formatResponse = function(response) {
65
     throw new Error("TranscriptionService.format is abstract");
65
     throw new Error("TranscriptionService.format is abstract");
66
 };
66
 };
67
 
67
 
72
  * @return {boolean} true if response is valid, false otherwise
72
  * @return {boolean} true if response is valid, false otherwise
73
  */
73
  */
74
 // eslint-disable-next-line no-unused-vars
74
 // eslint-disable-next-line no-unused-vars
75
-TranscriptionService.prototype.verify = function(response){
75
+TranscriptionService.prototype.verify = function(response) {
76
     throw new Error("TranscriptionService.verify is abstract");
76
     throw new Error("TranscriptionService.verify is abstract");
77
 };
77
 };
78
 
78
 

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

62
     // the first value in the JSON array
62
     // the first value in the JSON array
63
     result.shift();
63
     result.shift();
64
     var array = [];
64
     var array = [];
65
-    result.forEach(function(word){
65
+    result.forEach(function(word) {
66
         if(!word.filler) {
66
         if(!word.filler) {
67
             array.push(new Word(word.word, word.start, word.end));
67
             array.push(new Word(word.word, word.start, word.end));
68
         }
68
         }
75
  * @param response the server response
75
  * @param response the server response
76
  * @return {boolean} whether the response is valid
76
  * @return {boolean} whether the response is valid
77
  */
77
  */
78
-SphinxService.prototype.verify = function(response){
78
+SphinxService.prototype.verify = function(response) {
79
     console.log("response from server:" + response.toString());
79
     console.log("response from server:" + response.toString());
80
     // test if server responded with a string object
80
     // test if server responded with a string object
81
-    if(typeof response !== "string"){
81
+    if(typeof response !== "string") {
82
         return false;
82
         return false;
83
     }
83
     }
84
     // test if the string can be parsed into valid JSON
84
     // test if the string can be parsed into valid JSON
85
     var json;
85
     var json;
86
     try{
86
     try{
87
         json = JSON.parse(response);
87
         json = JSON.parse(response);
88
-    } catch (error){
88
+    } catch (error) {
89
         console.log(error);
89
         console.log(error);
90
         return false;
90
         return false;
91
     }
91
     }
92
     // check if the JSON has a "objects" value
92
     // check if the JSON has a "objects" value
93
-    if(json.objects === undefined){
93
+    if(json.objects === undefined) {
94
         return false;
94
         return false;
95
     }
95
     }
96
     // get the "objects" value and check for a session ID
96
     // get the "objects" value and check for a session ID
97
     var array = json.objects;
97
     var array = json.objects;
98
-    if(!(array[0] && array[0]["session-id"])){
98
+    if(!(array[0] && array[0]["session-id"])) {
99
         return false;
99
         return false;
100
     }
100
     }
101
     // everything seems to be in order
101
     // everything seems to be in order
111
 function getURL() {
111
 function getURL() {
112
     var message = "config does not contain an url to a " +
112
     var message = "config does not contain an url to a " +
113
     "Sphinx4 https server";
113
     "Sphinx4 https server";
114
-    if(config.sphinxURL === undefined){
114
+    if(config.sphinxURL === undefined) {
115
         console.log(message);
115
         console.log(message);
116
     } else {
116
     } else {
117
         var toReturn = config.sphinxURL;
117
         var toReturn = config.sphinxURL;
118
-        if(toReturn.includes !== undefined && toReturn.includes("https://")){
118
+        if(toReturn.includes !== undefined && toReturn.includes("https://")) {
119
             return toReturn;
119
             return toReturn;
120
         } else{
120
         } else{
121
             console.log(message);
121
             console.log(message);

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

49
         }
49
         }
50
 
50
 
51
         var log = [];
51
         var log = [];
52
-        node.children.forEach(function(item){
52
+        node.children.forEach(function(item) {
53
 
53
 
54
             var componentName = item.attributes.name;
54
             var componentName = item.attributes.name;
55
             if (componentName !== ComponentsVersions.FOCUS_COMPONENT &&
55
             if (componentName !== ComponentsVersions.FOCUS_COMPONENT &&

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

33
     json2packet(nodes, packet) {
33
     json2packet(nodes, packet) {
34
         for(let i = 0; i < nodes.length; i++) {
34
         for(let i = 0; i < nodes.length; i++) {
35
             const node = nodes[i];
35
             const node = nodes[i];
36
-            if(!node || node === null){
36
+            if(!node || node === null) {
37
                 continue;
37
                 continue;
38
             }
38
             }
39
             packet.c(node.tagName, node.attributes);
39
             packet.c(node.tagName, node.attributes);
54
  * @param pres the presence JSON
54
  * @param pres the presence JSON
55
  * @param nodeName the name of the node (videomuted, audiomuted, etc)
55
  * @param nodeName the name of the node (videomuted, audiomuted, etc)
56
  */
56
  */
57
-function filterNodeFromPresenceJSON(pres, nodeName){
57
+function filterNodeFromPresenceJSON(pres, nodeName) {
58
     var res = [];
58
     var res = [];
59
     for(let i = 0; i < pres.length; i++) {
59
     for(let i = 0; i < pres.length; i++) {
60
         if(pres[i].tagName === nodeName) {
60
         if(pres[i].tagName === nodeName) {

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

1
 var SDPUtil = require("./SDPUtil");
1
 var SDPUtil = require("./SDPUtil");
2
 
2
 
3
-function SDPDiffer(mySDP, otherSDP){
3
+function SDPDiffer(mySDP, otherSDP) {
4
     this.mySDP = mySDP;
4
     this.mySDP = mySDP;
5
     this.otherSDP = otherSDP;
5
     this.otherSDP = otherSDP;
6
 }
6
 }
55
             if(Object.keys(myMedia.ssrcs).indexOf(ssrc) === -1) {
55
             if(Object.keys(myMedia.ssrcs).indexOf(ssrc) === -1) {
56
                 // Allocate channel if we've found ssrc that doesn't exist in
56
                 // Allocate channel if we've found ssrc that doesn't exist in
57
                 // our channel
57
                 // our channel
58
-                if(!newMedia[othersMediaIdx]){
58
+                if(!newMedia[othersMediaIdx]) {
59
                     newMedia[othersMediaIdx] = {
59
                     newMedia[othersMediaIdx] = {
60
                         mediaindex: othersMedia.mediaindex,
60
                         mediaindex: othersMedia.mediaindex,
61
                         mid: othersMedia.mid,
61
                         mid: othersMedia.mid,
68
         });
68
         });
69
 
69
 
70
         // Look for new ssrc groups across the channels
70
         // Look for new ssrc groups across the channels
71
-        othersMedia.ssrcGroups.forEach(function(otherSsrcGroup){
71
+        othersMedia.ssrcGroups.forEach(function(otherSsrcGroup) {
72
 
72
 
73
             // try to match the other ssrc-group with an ssrc-group of ours
73
             // try to match the other ssrc-group with an ssrc-group of ours
74
             var matched = false;
74
             var matched = false;
87
                 // Allocate channel if we've found an ssrc-group that doesn't
87
                 // Allocate channel if we've found an ssrc-group that doesn't
88
                 // exist in our channel
88
                 // exist in our channel
89
 
89
 
90
-                if(!newMedia[othersMediaIdx]){
90
+                if(!newMedia[othersMediaIdx]) {
91
                     newMedia[othersMediaIdx] = {
91
                     newMedia[othersMediaIdx] = {
92
                         mediaindex: othersMedia.mediaindex,
92
                         mediaindex: othersMedia.mediaindex,
93
                         mid: othersMedia.mid,
93
                         mid: othersMedia.mid,
109
     var sdpMediaSsrcs = this.getNewMedia();
109
     var sdpMediaSsrcs = this.getNewMedia();
110
 
110
 
111
     var modified = false;
111
     var modified = false;
112
-    Object.keys(sdpMediaSsrcs).forEach(function(mediaindex){
112
+    Object.keys(sdpMediaSsrcs).forEach(function(mediaindex) {
113
         modified = true;
113
         modified = true;
114
         var media = sdpMediaSsrcs[mediaindex];
114
         var media = sdpMediaSsrcs[mediaindex];
115
         modify.c('content', {name: media.mid});
115
         modify.c('content', {name: media.mid});

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

86
 Recording.prototype.setRecordingJibri
86
 Recording.prototype.setRecordingJibri
87
     = function(state, callback, errCallback, options) {
87
     = function(state, callback, errCallback, options) {
88
 
88
 
89
-        if (state == this.state){
89
+        if (state == this.state) {
90
             errCallback(JitsiRecorderErrors.INVALID_STATE);
90
             errCallback(JitsiRecorderErrors.INVALID_STATE);
91
         }
91
         }
92
         options = options || {};
92
         options = options || {};
119
 Recording.prototype.setRecordingJirecon =
119
 Recording.prototype.setRecordingJirecon =
120
     function(state, callback, errCallback) {
120
     function(state, callback, errCallback) {
121
 
121
 
122
-        if (state == this.state){
122
+        if (state == this.state) {
123
             errCallback(new Error("Invalid state!"));
123
             errCallback(new Error("Invalid state!"));
124
         }
124
         }
125
 
125
 
129
                 ? Recording.action.START
129
                 ? Recording.action.START
130
                 : Recording.action.STOP,
130
                 : Recording.action.STOP,
131
             mucjid: this.roomjid});
131
             mucjid: this.roomjid});
132
-        if (state === 'off'){
132
+        if (state === 'off') {
133
             iq.attrs({rid: this.jireconRid});
133
             iq.attrs({rid: this.jireconRid});
134
         }
134
         }
135
 
135
 
145
                 (state === Recording.status.ON ? 'started' : 'stopped') +
145
                 (state === Recording.status.ON ? 'started' : 'stopped') +
146
                 '(jirecon)' + result);
146
                 '(jirecon)' + result);
147
             self.state = state;
147
             self.state = state;
148
-            if (state === Recording.status.OFF){
148
+            if (state === Recording.status.OFF) {
149
                 self.jireconRid = null;
149
                 self.jireconRid = null;
150
             }
150
             }
151
 
151
 
179
             callback(newState);
179
             callback(newState);
180
 
180
 
181
             if (newState === 'pending') {
181
             if (newState === 'pending') {
182
-                self.connection.addHandler(function(iq){
182
+                self.connection.addHandler(function(iq) {
183
                     var state = $(iq).find('recording').attr('state');
183
                     var state = $(iq).find('recording').attr('state');
184
                     if (state) {
184
                     if (state) {
185
                         self.state = newState;
185
                         self.state = newState;
197
 
197
 
198
 Recording.prototype.setRecording =
198
 Recording.prototype.setRecording =
199
 function(state, callback, errCallback, options) {
199
 function(state, callback, errCallback, options) {
200
-    switch(this.type){
200
+    switch(this.type) {
201
     case Recording.types.JIRECON:
201
     case Recording.types.JIRECON:
202
         this.setRecordingJirecon(state, callback, errCallback, options);
202
         this.setRecordingJirecon(state, callback, errCallback, options);
203
         break;
203
         break;

Loading…
Cancel
Save