Browse Source

[eslint] max-len

tags/v0.0.2
Lyubo Marinov 8 years ago
parent
commit
308adc133a

+ 1
- 0
.eslintrc.js View File

@@ -179,6 +179,7 @@ module.exports = {
179 179
                 'beforeLineComment': true
180 180
             }
181 181
         ],
182
+        'max-len': [ 'error', 80 ],
182 183
         'max-lines': 0,
183 184
         'max-nested-callbacks': 2,
184 185
         'max-statements': 0,

+ 44
- 20
JitsiConference.js View File

@@ -30,9 +30,11 @@ const logger = getLogger(__filename);
30 30
  * Creates a JitsiConference object with the given name and properties.
31 31
  * Note: this constructor is not a part of the public API (objects should be
32 32
  * created using JitsiConnection.createConference).
33
- * @param options.config properties / settings related to the conference that will be created.
33
+ * @param options.config properties / settings related to the conference that
34
+ * will be created.
34 35
  * @param options.name the name of the conference
35
- * @param options.connection the JitsiConnection object for this JitsiConference.
36
+ * @param options.connection the JitsiConnection object for this
37
+ * JitsiConference.
36 38
  * @constructor
37 39
  */
38 40
 function JitsiConference(options) {
@@ -133,7 +135,8 @@ JitsiConference.prototype._init = function(options) {
133 135
             callStatsID: this.options.config.callStatsID,
134 136
             callStatsSecret: this.options.config.callStatsSecret,
135 137
             callStatsConfIDNamespace:
136
-                this.options.config.callStatsConfIDNamespace || window.location.hostname,
138
+                this.options.config.callStatsConfIDNamespace
139
+                    || window.location.hostname,
137 140
             callStatsCustomScriptUrl:
138 141
                 this.options.config.callStatsCustomScriptUrl,
139 142
             roomName: this.options.name
@@ -303,12 +306,13 @@ JitsiConference.prototype.getLocalVideoTrack = function() {
303 306
 };
304 307
 
305 308
 /**
306
- * Attaches a handler for events(For example - "participant joined".) in the conference. All possible event are defined
307
- * in JitsiConferenceEvents.
309
+ * Attaches a handler for events(For example - "participant joined".) in the
310
+ * conference. All possible event are defined in JitsiConferenceEvents.
308 311
  * @param eventId the event ID.
309 312
  * @param handler handler for the event.
310 313
  *
311
- * Note: consider adding eventing functionality by extending an EventEmitter impl, instead of rolling ourselves
314
+ * Note: consider adding eventing functionality by extending an EventEmitter
315
+ * impl, instead of rolling ourselves
312 316
  */
313 317
 JitsiConference.prototype.on = function(eventId, handler) {
314 318
     if (this.eventEmitter) {
@@ -321,7 +325,8 @@ JitsiConference.prototype.on = function(eventId, handler) {
321 325
  * @param eventId the event ID.
322 326
  * @param [handler] optional, the specific handler to unbind
323 327
  *
324
- * Note: consider adding eventing functionality by extending an EventEmitter impl, instead of rolling ourselves
328
+ * Note: consider adding eventing functionality by extending an EventEmitter
329
+ * impl, instead of rolling ourselves
325 330
  */
326 331
 JitsiConference.prototype.off = function(eventId, handler) {
327 332
     if (this.eventEmitter) {
@@ -561,7 +566,8 @@ JitsiConference.prototype.replaceTrack = function(oldTrack, newTrack) {
561 566
                 new JitsiTrackError(JitsiTrackErrors.TRACK_IS_DISPOSED));
562 567
         }
563 568
 
564
-        // Set up the ssrcHandler for the new track before we add it at the lower levels
569
+        // Set up the ssrcHandler for the new track before we add it at the
570
+        // lower levels
565 571
         newTrack.ssrcHandler = function(conference, ssrcMap) {
566 572
             const trackSSRCInfo = ssrcMap.get(this.getMSID());
567 573
 
@@ -583,7 +589,8 @@ JitsiConference.prototype.replaceTrack = function(oldTrack, newTrack) {
583 589
                 this.onLocalTrackRemoved(oldTrack);
584 590
             }
585 591
             if (newTrack) {
586
-                // Now handle the addition of the newTrack at the JitsiConference level
592
+                // Now handle the addition of the newTrack at the
593
+                // JitsiConference level
587 594
                 this._setupNewTrack(newTrack);
588 595
             }
589 596
 
@@ -675,10 +682,12 @@ JitsiConference.prototype._setupNewTrack = function(newTrack) {
675 682
 /**
676 683
  * Adds loca WebRTC stream to the conference.
677 684
  * @param {MediaStream} stream new stream that will be added.
678
- * @param {function} callback callback executed after successful stream addition.
679
- * @param {function(error)} errorCallback callback executed if stream addition fail.
680
- * @param {object} ssrcInfo object with information about the SSRCs associated with the
681
- * stream.
685
+ * @param {function} callback callback executed after successful stream
686
+ * addition.
687
+ * @param {function(error)} errorCallback callback executed if stream addition
688
+ * fail.
689
+ * @param {object} ssrcInfo object with information about the SSRCs associated
690
+ * with the stream.
682 691
  * @param {boolean} [dontModifySources] if <tt>true</tt> _modifySources won't be
683 692
  * called. The option is used for adding stream, before the Jingle call is
684 693
  * started. That is before the 'session-accept' is sent.
@@ -709,8 +718,9 @@ JitsiConference.prototype.removeLocalStream
709 718
             this.jingleSession.removeStream(
710 719
             stream, callback, errorCallback, ssrcInfo);
711 720
         } else {
712
-        // We are done immediately
713
-            logger.warn('Remove local MediaStream - no JingleSession started yet');
721
+            // We are done immediately
722
+            logger.warn(
723
+                'Remove local MediaStream - no JingleSession started yet');
714 724
             callback();
715 725
         }
716 726
     };
@@ -903,7 +913,10 @@ JitsiConference.prototype.onMemberJoined
903 913
 
904 914
         participant._role = role;
905 915
         this.participants[id] = participant;
906
-        this.eventEmitter.emit(JitsiConferenceEvents.USER_JOINED, id, participant);
916
+        this.eventEmitter.emit(
917
+            JitsiConferenceEvents.USER_JOINED,
918
+            id,
919
+            participant);
907 920
         this.xmpp.caps.getFeatures(jid).then(features => {
908 921
             participant._supportsDTMF = features.has('urn:xmpp:jingle:dtmf:0');
909 922
             this.updateDTMFSupport();
@@ -957,7 +970,10 @@ JitsiConference.prototype.onDisplayNameChanged = function(jid, displayName) {
957 970
     }
958 971
 
959 972
     participant._displayName = displayName;
960
-    this.eventEmitter.emit(JitsiConferenceEvents.DISPLAY_NAME_CHANGED, id, displayName);
973
+    this.eventEmitter.emit(
974
+        JitsiConferenceEvents.DISPLAY_NAME_CHANGED,
975
+        id,
976
+        displayName);
961 977
 };
962 978
 
963 979
 /**
@@ -1113,7 +1129,9 @@ JitsiConference.prototype.onIncomingCall
1113 1129
          *  consistent
1114 1130
          */
1115 1131
 
1116
-        if (localTrack.isVideoTrack() && localTrack.isMuted() && !RTCBrowserType.isFirefox()) {
1132
+        if (localTrack.isVideoTrack()
1133
+                && localTrack.isMuted()
1134
+                && !RTCBrowserType.isFirefox()) {
1117 1135
             /**
1118 1136
              * Handles issues when the stream is added before the peerconnection
1119 1137
              * is created. The peerconnection is created when second participant
@@ -1244,7 +1262,9 @@ JitsiConference.prototype.updateDTMFSupport = function() {
1244 1262
     }
1245 1263
     if (somebodySupportsDTMF !== this.somebodySupportsDTMF) {
1246 1264
         this.somebodySupportsDTMF = somebodySupportsDTMF;
1247
-        this.eventEmitter.emit(JitsiConferenceEvents.DTMF_SUPPORT_CHANGED, somebodySupportsDTMF);
1265
+        this.eventEmitter.emit(
1266
+            JitsiConferenceEvents.DTMF_SUPPORT_CHANGED,
1267
+            somebodySupportsDTMF);
1248 1268
     }
1249 1269
 };
1250 1270
 
@@ -1262,7 +1282,11 @@ JitsiConference.prototype.isDTMFSupported = function() {
1262 1282
  * @return {string} local user's ID
1263 1283
  */
1264 1284
 JitsiConference.prototype.myUserId = function() {
1265
-    return this.room && this.room.myroomjid ? Strophe.getResourceFromJid(this.room.myroomjid) : null;
1285
+    return (
1286
+        this.room
1287
+            && this.room.myroomjid
1288
+                ? Strophe.getResourceFromJid(this.room.myroomjid)
1289
+                : null);
1266 1290
 };
1267 1291
 
1268 1292
 JitsiConference.prototype.sendTones = function(tones, duration, pause) {

+ 6
- 4
JitsiConnection.js View File

@@ -5,11 +5,13 @@ import XMPP from './modules/xmpp/xmpp';
5 5
 const Statistics = require('./modules/statistics/statistics');
6 6
 
7 7
 /**
8
- * Creates new connection object for the Jitsi Meet server side video conferencing service. Provides access to the
9
- * JitsiConference interface.
10
- * @param appID identification for the provider of Jitsi Meet video conferencing services.
8
+ * Creates new connection object for the Jitsi Meet server side video
9
+ * conferencing service. Provides access to the JitsiConference interface.
10
+ * @param appID identification for the provider of Jitsi Meet video conferencing
11
+ * services.
11 12
  * @param token the JWT token used to authenticate with the server(optional)
12
- * @param options Object with properties / settings related to connection with the server.
13
+ * @param options Object with properties / settings related to connection with
14
+ * the server.
13 15
  * @constructor
14 16
  */
15 17
 function JitsiConnection(appID, token, options) {

+ 9
- 6
JitsiMeetJS.js View File

@@ -1,7 +1,8 @@
1 1
 /* global __filename */
2 2
 
3 3
 import AuthUtil from './modules/util/AuthUtil';
4
-import * as ConnectionQualityEvents from './service/connectivity/ConnectionQualityEvents';
4
+import * as ConnectionQualityEvents
5
+    from './service/connectivity/ConnectionQualityEvents';
5 6
 import GlobalOnErrorHandler from './modules/util/GlobalOnErrorHandler';
6 7
 import * as JitsiConferenceErrors from './JitsiConferenceErrors';
7 8
 import * as JitsiConferenceEvents from './JitsiConferenceEvents';
@@ -183,13 +184,15 @@ const LibJitsiMeet = {
183 184
 
184 185
     /**
185 186
      * Creates the media tracks and returns them trough the callback.
186
-     * @param options Object with properties / settings specifying the tracks which should be created.
187
-     * should be created or some additional configurations about resolution for example.
187
+     * @param options Object with properties / settings specifying the tracks
188
+     * which should be created. should be created or some additional
189
+     * configurations about resolution for example.
188 190
      * @param {Array} options.devices the devices that will be requested
189 191
      * @param {string} options.resolution resolution constraints
190
-     * @param {bool} options.dontCreateJitsiTrack if <tt>true</tt> objects with the following structure {stream: the Media Stream,
191
-     * type: "audio" or "video", videoType: "camera" or "desktop"}
192
-     * will be returned trough the Promise, otherwise JitsiTrack objects will be returned.
192
+     * @param {bool} options.dontCreateJitsiTrack if <tt>true</tt> objects with
193
+     * the following structure {stream: the Media Stream, type: "audio" or
194
+     * "video", videoType: "camera" or "desktop"} will be returned trough the
195
+     * Promise, otherwise JitsiTrack objects will be returned.
193 196
      * @param {string} options.cameraDeviceId
194 197
      * @param {string} options.micDeviceId
195 198
      * @param {object} options.desktopSharingExtensionExternalInstallation -

+ 39
- 23
doc/example/example.js View File

@@ -6,7 +6,9 @@ const options = {
6 6
         muc: 'conference.jitsi-meet.example.com' // FIXME: use XEP-0030
7 7
     },
8 8
     bosh: '//jitsi-meet.example.com/http-bind', // FIXME: use xep-0156 for that
9
-    clientNode: 'http://jitsi.org/jitsimeet' // The name of client node advertised in XEP-0115 'c' stanza
9
+
10
+    // The name of client node advertised in XEP-0115 'c' stanza
11
+    clientNode: 'http://jitsi.org/jitsimeet'
10 12
 };
11 13
 
12 14
 const confOptions = {
@@ -45,7 +47,8 @@ function onLocalTracks(tracks) {
45 47
             $('body').append(`<video autoplay='1' id='localVideo${i}' />`);
46 48
             localTracks[i].attach($(`#localVideo${i}`)[0]);
47 49
         } else {
48
-            $('body').append(`<audio autoplay='1' muted='true' id='localAudio${i}' />`);
50
+            $('body').append(
51
+                `<audio autoplay='1' muted='true' id='localAudio${i}' />`);
49 52
             localTracks[i].attach($(`#localAudio${i}`)[0]);
50 53
         }
51 54
         if (isJoined) {
@@ -85,9 +88,11 @@ function onRemoteTrack(track) {
85 88
     const id = participant + track.getType() + idx;
86 89
 
87 90
     if (track.getType() == 'video') {
88
-        $('body').append(`<video autoplay='1' id='${participant}video${idx}' />`);
91
+        $('body').append(
92
+            `<video autoplay='1' id='${participant}video${idx}' />`);
89 93
     } else {
90
-        $('body').append(`<audio autoplay='1' id='${participant}audio${idx}' />`);
94
+        $('body').append(
95
+            `<audio autoplay='1' id='${participant}audio${idx}' />`);
91 96
     }
92 97
     track.attach($(`#${id}`)[0]);
93 98
 }
@@ -124,7 +129,9 @@ function onConnectionSuccess() {
124 129
     room.on(JitsiMeetJS.events.conference.TRACK_REMOVED, track => {
125 130
         console.log(`track removed!!!${track}`);
126 131
     });
127
-    room.on(JitsiMeetJS.events.conference.CONFERENCE_JOINED, onConferenceJoined);
132
+    room.on(
133
+        JitsiMeetJS.events.conference.CONFERENCE_JOINED,
134
+        onConferenceJoined);
128 135
     room.on(JitsiMeetJS.events.conference.USER_JOINED, id => {
129 136
         console.log('user join');
130 137
         remoteTracks[id] = [];
@@ -133,9 +140,9 @@ function onConnectionSuccess() {
133 140
     room.on(JitsiMeetJS.events.conference.TRACK_MUTE_CHANGED, track => {
134 141
         console.log(`${track.getType()} - ${track.isMuted()}`);
135 142
     });
136
-    room.on(JitsiMeetJS.events.conference.DISPLAY_NAME_CHANGED, (userID, displayName) => {
137
-        console.log(`${userID} - ${displayName}`);
138
-    });
143
+    room.on(
144
+        JitsiMeetJS.events.conference.DISPLAY_NAME_CHANGED,
145
+        (userID, displayName) => console.log(`${userID} - ${displayName}`));
139 146
     room.on(JitsiMeetJS.events.conference.TRACK_AUDIO_LEVEL_CHANGED,
140 147
       (userID, audioLevel) => {
141 148
           console.log(`${userID} - ${audioLevel}`);
@@ -172,9 +179,15 @@ function onDeviceListChanged(devices) {
172 179
  */
173 180
 function disconnect() {
174 181
     console.log('disconnect!');
175
-    connection.removeEventListener(JitsiMeetJS.events.connection.CONNECTION_ESTABLISHED, onConnectionSuccess);
176
-    connection.removeEventListener(JitsiMeetJS.events.connection.CONNECTION_FAILED, onConnectionFailed);
177
-    connection.removeEventListener(JitsiMeetJS.events.connection.CONNECTION_DISCONNECTED, disconnect);
182
+    connection.removeEventListener(
183
+        JitsiMeetJS.events.connection.CONNECTION_ESTABLISHED,
184
+        onConnectionSuccess);
185
+    connection.removeEventListener(
186
+        JitsiMeetJS.events.connection.CONNECTION_FAILED,
187
+        onConnectionFailed);
188
+    connection.removeEventListener(
189
+        JitsiMeetJS.events.connection.CONNECTION_DISCONNECTED,
190
+        disconnect);
178 191
 }
179 192
 
180 193
 function unload() {
@@ -193,17 +206,16 @@ function switchVideo() { // eslint-disable-line no-unused-vars
193 206
         localTracks[1].dispose();
194 207
         localTracks.pop();
195 208
     }
196
-    JitsiMeetJS.createLocalTracks({ devices: isVideo ? [ 'video' ] : [ 'desktop' ] })
209
+    JitsiMeetJS.createLocalTracks(
210
+            { devices: isVideo ? [ 'video' ] : [ 'desktop' ] })
197 211
         .then(tracks => {
198 212
             localTracks.push(tracks[0]);
199
-            localTracks[1].addEventListener(JitsiMeetJS.events.track.TRACK_MUTE_CHANGED,
200
-                () => {
201
-                    console.log('local track muted');
202
-                });
203
-            localTracks[1].addEventListener(JitsiMeetJS.events.track.LOCAL_TRACK_STOPPED,
204
-                () => {
205
-                    console.log('local track stoped');
206
-                });
213
+            localTracks[1].addEventListener(
214
+                JitsiMeetJS.events.track.TRACK_MUTE_CHANGED,
215
+                () => console.log('local track muted'));
216
+            localTracks[1].addEventListener(
217
+                JitsiMeetJS.events.track.LOCAL_TRACK_STOPPED,
218
+                () => console.log('local track stoped'));
207 219
             localTracks[1].attach($('#localVideo1')[0]);
208 220
             room.addTrack(localTracks[1]);
209 221
         })
@@ -281,12 +293,16 @@ JitsiMeetJS.init(initOptions)
281 293
 
282 294
 if (JitsiMeetJS.mediaDevices.isDeviceChangeAvailable('output')) {
283 295
     JitsiMeetJS.mediaDevices.enumerateDevices(devices => {
284
-        const audioOutputDevices = devices.filter(d => d.kind === 'audiooutput');
296
+        const audioOutputDevices
297
+            = devices.filter(d => d.kind === 'audiooutput');
285 298
 
286 299
         if (audioOutputDevices.length > 1) {
287 300
             $('#audioOutputSelect').html(
288
-                audioOutputDevices.map(d => `<option value="${d.deviceId}">${d.label}</option>`).join('\n')
289
-            );
301
+                audioOutputDevices
302
+                    .map(
303
+                        d =>
304
+                            `<option value="${d.deviceId}">${d.label}</option>`)
305
+                    .join('\n'));
290 306
 
291 307
             $('#audioOutputSelectWrapper').show();
292 308
         }

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

@@ -16,10 +16,10 @@ function DataChannels(peerConnection, emitter) {
16 16
     this._dataChannels = [];
17 17
 
18 18
     // Sample code for opening new data channel from Jitsi Meet to the bridge.
19
-    // Although it's not a requirement to open separate channels from both bridge
20
-    // and peer as single channel can be used for sending and receiving data.
21
-    // So either channel opened by the bridge or the one opened here is enough
22
-    // for communication with the bridge.
19
+    // Although it's not a requirement to open separate channels from both
20
+    // bridge and peer as single channel can be used for sending and receiving
21
+    // data. So either channel opened by the bridge or the one opened here is
22
+    // enough for communication with the bridge.
23 23
     /* var dataChannelOptions =
24 24
      {
25 25
      reliable: true
@@ -141,7 +141,8 @@ DataChannels.prototype.onDataChannel = function(event) {
141 141
                 self.eventEmitter.emit(
142 142
                     RTCEvents.ENDPOINT_MESSAGE_RECEIVED, obj.from,
143 143
                     obj.msgPayload);
144
-            } else if (colibriClass === 'EndpointConnectivityStatusChangeEvent') {
144
+            } else if (colibriClass
145
+                    === 'EndpointConnectivityStatusChangeEvent') {
145 146
                 const endpoint = obj.endpoint;
146 147
                 const isActive = obj.active === 'true';
147 148
 

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

@@ -328,7 +328,8 @@ JitsiLocalTrack.prototype._setMute = function(mute) {
328 328
         promise = RTCUtils.obtainAudioAndVideoPermissions(streamOptions)
329 329
             .then(streamsInfo => {
330 330
                 const mediaType = self.getType();
331
-                const streamInfo = streamsInfo.find(info => info.mediaType === mediaType);
331
+                const streamInfo
332
+                    = streamsInfo.find(info => info.mediaType === mediaType);
332 333
 
333 334
                 if (streamInfo) {
334 335
                     self._setStream(streamInfo.stream);
@@ -347,7 +348,9 @@ JitsiLocalTrack.prototype._setMute = function(mute) {
347 348
                         JitsiTrackErrors.TRACK_NO_STREAM_FOUND);
348 349
                 }
349 350
 
350
-                self.containers = self.containers.map(cont => RTCUtils.attachMediaStream(cont, self.stream));
351
+                self.containers
352
+                    = self.containers.map(
353
+                        cont => RTCUtils.attachMediaStream(cont, self.stream));
351 354
 
352 355
                 return self._addStreamToConferenceAsUnmute();
353 356
             });

+ 27
- 14
modules/RTC/JitsiTrack.js View File

@@ -67,8 +67,14 @@ function addMediaStreamInactiveHandler(mediaStream, handler) {
67 67
  * @param videoType the VideoType for this track if any
68 68
  * @param ssrc the SSRC of this track if known
69 69
  */
70
-function JitsiTrack(conference, stream, track, streamInactiveHandler, trackMediaType,
71
-                    videoType, ssrc) {
70
+function JitsiTrack(
71
+        conference,
72
+        stream,
73
+        track,
74
+        streamInactiveHandler,
75
+        trackMediaType,
76
+        videoType,
77
+        ssrc) {
72 78
     /**
73 79
      * Array with the HTML elements that are displaying the streams.
74 80
      * @type {Array}
@@ -418,18 +424,25 @@ JitsiTrack.prototype.setAudioOutput = function(audioOutputDeviceId) {
418 424
         return Promise.resolve();
419 425
     }
420 426
 
421
-    return Promise.all(this.containers.map(element => element.setSinkId(audioOutputDeviceId)
422
-            .catch(error => {
423
-                logger.warn(
424
-                    'Failed to change audio output device on element. Default'
425
-                    + ' or previously set audio output device will be used.',
426
-                    element, error);
427
-                throw error;
428
-            })))
429
-    .then(() => {
430
-        self.eventEmitter.emit(JitsiTrackEvents.TRACK_AUDIO_OUTPUT_CHANGED,
431
-            audioOutputDeviceId);
432
-    });
427
+    return (
428
+        Promise.all(
429
+                this.containers.map(
430
+                    element =>
431
+                        element.setSinkId(audioOutputDeviceId)
432
+                            .catch(error => {
433
+                                logger.warn(
434
+                                    'Failed to change audio output device on'
435
+                                        + ' element. Default or previously set'
436
+                                        + ' audio output device will be used.',
437
+                                    element,
438
+                                    error);
439
+                                throw error;
440
+                            })))
441
+            .then(() => {
442
+                self.eventEmitter.emit(
443
+                    JitsiTrackEvents.TRACK_AUDIO_OUTPUT_CHANGED,
444
+                    audioOutputDeviceId);
445
+            }));
433 446
 };
434 447
 
435 448
 module.exports = JitsiTrack;

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

@@ -66,12 +66,12 @@ export default class RTC extends Listenable {
66 66
 
67 67
         // A flag whether we had received that the data channel had opened
68 68
         // we can get this flag out of sync if for some reason data channel got
69
-        // closed from server, a desired behaviour so we can see errors when this
70
-        // happen
69
+        // closed from server, a desired behaviour so we can see errors when
70
+        // this happen
71 71
         this.dataChannelsOpen = false;
72 72
 
73
-        // Switch audio output device on all remote audio tracks. Local audio tracks
74
-        // handle this event by themselves.
73
+        // Switch audio output device on all remote audio tracks. Local audio
74
+        // tracks handle this event by themselves.
75 75
         if (RTCUtils.isDeviceChangeAvailable('output')) {
76 76
             RTCUtils.addListener(RTCEvents.AUDIO_OUTPUT_DEVICE_CHANGED,
77 77
                 deviceId => {
@@ -90,11 +90,10 @@ export default class RTC extends Listenable {
90 90
      * @param {Object} [options] optional parameters
91 91
      * @param {Array} options.devices the devices that will be requested
92 92
      * @param {string} options.resolution resolution constraints
93
-     * @param {bool} options.dontCreateJitsiTrack if <tt>true</tt> objects with the
94
-     * following structure {stream: the Media Stream,
95
-     * type: "audio" or "video", videoType: "camera" or "desktop"}
96
-     * will be returned trough the Promise, otherwise JitsiTrack objects will be
97
-     * returned.
93
+     * @param {bool} options.dontCreateJitsiTrack if <tt>true</tt> objects with
94
+     * the following structure {stream: the Media Stream, type: "audio" or
95
+     * "video", videoType: "camera" or "desktop"} will be returned trough the
96
+     * Promise, otherwise JitsiTrack objects will be returned.
98 97
      * @param {string} options.cameraDeviceId
99 98
      * @param {string} options.micDeviceId
100 99
      * @returns {*} Promise object that will receive the new JitsiTracks
@@ -186,7 +185,8 @@ export default class RTC extends Listenable {
186 185
      * order to always receive video for this participant (even when last n is
187 186
      * enabled).
188 187
      * @param id {string} the user id
189
-     * @throws NetworkError or InvalidStateError or Error if the operation fails.
188
+     * @throws NetworkError or InvalidStateError or Error if the operation
189
+     * fails.
190 190
      */
191 191
     pinEndpoint(id) {
192 192
         if (this.dataChannels) {
@@ -364,8 +364,8 @@ export default class RTC extends Listenable {
364 364
     }
365 365
 
366 366
     /**
367
-     * Gets JitsiRemoteTrack for AUDIO MediaType associated with given MUC nickname
368
-     * (resource part of the JID).
367
+     * Gets JitsiRemoteTrack for AUDIO MediaType associated with given MUC
368
+     * nickname (resource part of the JID).
369 369
      * @param resource the resource part of the MUC JID
370 370
      * @returns {JitsiRemoteTrack|null}
371 371
      */
@@ -374,8 +374,8 @@ export default class RTC extends Listenable {
374 374
     }
375 375
 
376 376
     /**
377
-     * Gets JitsiRemoteTrack for VIDEO MediaType associated with given MUC nickname
378
-     * (resource part of the JID).
377
+     * Gets JitsiRemoteTrack for VIDEO MediaType associated with given MUC
378
+     * nickname (resource part of the JID).
379 379
      * @param resource the resource part of the MUC JID
380 380
      * @returns {JitsiRemoteTrack|null}
381 381
      */
@@ -699,7 +699,7 @@ export default class RTC extends Listenable {
699 699
      * matches given SSRC or <tt>undefined</tt> if no such track was found.
700 700
      */
701 701
     getRemoteTrackBySSRC(ssrc) {
702
-        return this.getRemoteTracks().find(remoteTrack => ssrc == remoteTrack.getSSRC());
702
+        return this.getRemoteTracks().find(t => ssrc == t.getSSRC());
703 703
     }
704 704
 
705 705
     /**

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

@@ -114,7 +114,8 @@ const RTCBrowserType = {
114 114
      */
115 115
     isTemasysPluginUsed() {
116 116
         // Temasys do not support Microsoft Edge:
117
-        // http://support.temasys.com.sg/support/solutions/articles/5000654345-can-the-temasys-webrtc-plugin-be-used-with-microsoft-edge-
117
+        // http://support.temasys.com.sg/support/solutions/articles/
118
+        // 5000654345-can-the-temasys-webrtc-plugin-be-used-with-microsoft-edge-
118 119
         if (RTCBrowserType.isIExplorer()
119 120
                 && RTCBrowserType.getIExplorerVersion() < 12) {
120 121
             return true;

+ 112
- 76
modules/RTC/RTCUtils.js View File

@@ -193,7 +193,8 @@ function getConstraints(um, options) {
193 193
             // for some cameras it might be necessary to request 30fps
194 194
             // so they choose 30fps mjpg over 10fps yuy2
195 195
             if (options.minFps || options.fps) {
196
-                options.minFps = options.minFps || options.fps; // Fall back to options.fps for backwards compatibility
196
+                // Fall back to options.fps for backwards compatibility
197
+                options.minFps = options.minFps || options.fps;
197 198
                 constraints.video.mandatory.minFrameRate = options.minFps;
198 199
             }
199 200
             if (options.maxFps) {
@@ -303,9 +304,10 @@ function getConstraints(um, options) {
303 304
         constraints.video.optional.push({ bandwidth: options.bandwidth });
304 305
     }
305 306
 
306
-    // we turn audio for both audio and video tracks, the fake audio & video seems to work
307
-    // only when enabled in one getUserMedia call, we cannot get fake audio separate by fake video
308
-    // this later can be a problem with some of the tests
307
+    // we turn audio for both audio and video tracks, the fake audio & video
308
+    // seems to work only when enabled in one getUserMedia call, we cannot get
309
+    // fake audio separate by fake video this later can be a problem with some
310
+    // of the tests
309 311
     if (RTCBrowserType.isFirefox() && options.firefox_fake_device) {
310 312
         // seems to be fixed now, removing this experimental fix, as having
311 313
         // multiple audio tracks brake the tests
@@ -401,7 +403,9 @@ function pollForAvailableMediaDevices() {
401 403
  */
402 404
 function onMediaDevicesListChanged(devicesReceived) {
403 405
     currentlyAvailableMediaDevices = devicesReceived.slice(0);
404
-    logger.info('list of media devices has changed:', currentlyAvailableMediaDevices);
406
+    logger.info(
407
+        'list of media devices has changed:',
408
+        currentlyAvailableMediaDevices);
405 409
 
406 410
     const videoInputDevices
407 411
         = currentlyAvailableMediaDevices.filter(d => d.kind === 'videoinput');
@@ -413,12 +417,14 @@ function onMediaDevicesListChanged(devicesReceived) {
413 417
         = audioInputDevices.filter(d => d.label === '');
414 418
 
415 419
     if (videoInputDevices.length
416
-        && videoInputDevices.length === videoInputDevicesWithEmptyLabels.length) {
420
+            && videoInputDevices.length
421
+                === videoInputDevicesWithEmptyLabels.length) {
417 422
         devices.video = false;
418 423
     }
419 424
 
420 425
     if (audioInputDevices.length
421
-        && audioInputDevices.length === audioInputDevicesWithEmptyLabels.length) {
426
+            && audioInputDevices.length
427
+                === audioInputDevicesWithEmptyLabels.length) {
422 428
         devices.audio = false;
423 429
     }
424 430
 
@@ -682,7 +688,8 @@ function wrapAttachMediaStream(origAttachMediaStream) {
682 688
                 && audioOutputChanged) {
683 689
             element.setSinkId(rtcUtils.getAudioOutputDevice())
684 690
                 .catch(function(ex) {
685
-                    const err = new JitsiTrackError(ex, null, [ 'audiooutput' ]);
691
+                    const err
692
+                        = new JitsiTrackError(ex, null, [ 'audiooutput' ]);
686 693
 
687 694
                     GlobalOnErrorHandler.callUnhandledRejectionHandler(
688 695
                         { promise: this,
@@ -780,28 +787,33 @@ class RTCUtils extends Listenable {
780 787
                     return;
781 788
                 }
782 789
                 this.peerconnection = mozRTCPeerConnection;
783
-                this.getUserMedia = wrapGetUserMedia(navigator.mozGetUserMedia.bind(navigator));
784
-                this.enumerateDevices = wrapEnumerateDevices(
785
-                    navigator.mediaDevices.enumerateDevices.bind(navigator.mediaDevices)
786
-                );
790
+                this.getUserMedia
791
+                    = wrapGetUserMedia(
792
+                        navigator.mozGetUserMedia.bind(navigator));
793
+                this.enumerateDevices
794
+                    = wrapEnumerateDevices(
795
+                        navigator.mediaDevices.enumerateDevices.bind(
796
+                            navigator.mediaDevices));
787 797
                 this.pc_constraints = {};
788
-                this.attachMediaStream = wrapAttachMediaStream((element, stream) => {
789
-                    //  srcObject is being standardized and FF will eventually
790
-                    //  support that unprefixed. FF also supports the
791
-                    //  "element.src = URL.createObjectURL(...)" combo, but that
792
-                    //  will be deprecated in favour of srcObject.
793
-                    //
794
-                    // https://groups.google.com/forum/#!topic/mozilla.dev.media/pKOiioXonJg
795
-                    // https://github.com/webrtc/samples/issues/302
796
-                    if (element) {
797
-                        defaultSetVideoSrc(element, stream);
798
-                        if (stream) {
799
-                            element.play();
798
+                this.attachMediaStream
799
+                    = wrapAttachMediaStream((element, stream) => {
800
+                        // srcObject is being standardized and FF will
801
+                        // eventually support that unprefixed. FF also supports
802
+                        // the "element.src = URL.createObjectURL(...)" combo,
803
+                        // but that will be deprecated in favour of srcObject.
804
+                        //
805
+                        // https://groups.google.com/forum/#!topic/
806
+                        // mozilla.dev.media/pKOiioXonJg
807
+                        // https://github.com/webrtc/samples/issues/302
808
+                        if (element) {
809
+                            defaultSetVideoSrc(element, stream);
810
+                            if (stream) {
811
+                                element.play();
812
+                            }
800 813
                         }
801
-                    }
802 814
 
803
-                    return element;
804
-                });
815
+                        return element;
816
+                    });
805 817
                 this.getStreamID = function(stream) {
806 818
                     let id = stream.id;
807 819
 
@@ -816,8 +828,13 @@ class RTCUtils extends Listenable {
816 828
 
817 829
                     return SDPUtil.filter_special_chars(id);
818 830
                 };
819
-                RTCSessionDescription = mozRTCSessionDescription; // eslint-disable-line
820
-                RTCIceCandidate = mozRTCIceCandidate;             // eslint-disable-line
831
+
832
+                /* eslint-disable no-global-assign, no-native-reassign */
833
+
834
+                RTCSessionDescription = mozRTCSessionDescription;
835
+                RTCIceCandidate = mozRTCIceCandidate;
836
+
837
+                /* eslint-enable no-global-assign, no-native-reassign */
821 838
             } else if (RTCBrowserType.isChrome()
822 839
                     || RTCBrowserType.isOpera()
823 840
                     || RTCBrowserType.isNWJS()
@@ -825,22 +842,26 @@ class RTCUtils extends Listenable {
825 842
                     || RTCBrowserType.isReactNative()) {
826 843
 
827 844
                 this.peerconnection = webkitRTCPeerConnection;
828
-                const getUserMedia = navigator.webkitGetUserMedia.bind(navigator);
845
+                const getUserMedia
846
+                    = navigator.webkitGetUserMedia.bind(navigator);
829 847
 
830 848
                 if (navigator.mediaDevices) {
831 849
                     this.getUserMedia = wrapGetUserMedia(getUserMedia);
832
-                    this.enumerateDevices = wrapEnumerateDevices(
833
-                        navigator.mediaDevices.enumerateDevices.bind(navigator.mediaDevices)
834
-                    );
850
+                    this.enumerateDevices
851
+                        = wrapEnumerateDevices(
852
+                            navigator.mediaDevices.enumerateDevices.bind(
853
+                                navigator.mediaDevices));
835 854
                 } else {
836 855
                     this.getUserMedia = getUserMedia;
837
-                    this.enumerateDevices = enumerateDevicesThroughMediaStreamTrack;
856
+                    this.enumerateDevices
857
+                      = enumerateDevicesThroughMediaStreamTrack;
838 858
                 }
839
-                this.attachMediaStream = wrapAttachMediaStream((element, stream) => {
840
-                    defaultSetVideoSrc(element, stream);
859
+                this.attachMediaStream
860
+                    = wrapAttachMediaStream((element, stream) => {
861
+                        defaultSetVideoSrc(element, stream);
841 862
 
842
-                    return element;
843
-                });
863
+                        return element;
864
+                    });
844 865
                 this.getStreamID = function(stream) {
845 866
                     // A. MediaStreams from FF endpoints have the characters '{'
846 867
                     // and '}' that make jQuery choke.
@@ -889,33 +910,37 @@ class RTCUtils extends Listenable {
889 910
                 const webRTCReadyCb = () => {
890 911
                     this.peerconnection = RTCPeerConnection;
891 912
                     this.getUserMedia = window.getUserMedia;
892
-                    this.enumerateDevices = enumerateDevicesThroughMediaStreamTrack;
893
-                    this.attachMediaStream = wrapAttachMediaStream((element, stream) => {
894
-                        if (stream) {
895
-                            if (stream.id === 'dummyAudio'
896
-                                    || stream.id === 'dummyVideo') {
897
-                                return;
898
-                            }
913
+                    this.enumerateDevices
914
+                        = enumerateDevicesThroughMediaStreamTrack;
915
+                    this.attachMediaStream
916
+                        = wrapAttachMediaStream((element, stream) => {
917
+                            if (stream) {
918
+                                if (stream.id === 'dummyAudio'
919
+                                        || stream.id === 'dummyVideo') {
920
+                                    return;
921
+                                }
899 922
 
900
-                            // The container must be visible in order to play or
901
-                            // attach the stream when Temasys plugin is in use
902
-                            const containerSel = $(element);
923
+                                // The container must be visible in order to
924
+                                // play or attach the stream when Temasys plugin
925
+                                // is in use
926
+                                const containerSel = $(element);
903 927
 
904
-                            if (RTCBrowserType.isTemasysPluginUsed()
905
-                                    && !containerSel.is(':visible')) {
906
-                                containerSel.show();
907
-                            }
908
-                            const video = stream.getVideoTracks().length > 0;
928
+                                if (RTCBrowserType.isTemasysPluginUsed()
929
+                                        && !containerSel.is(':visible')) {
930
+                                    containerSel.show();
931
+                                }
932
+                                const video
933
+                                    = stream.getVideoTracks().length > 0;
909 934
 
910
-                            if (video && !$(element).is(':visible')) {
911
-                                throw new Error(
912
-                                    'video element must be visible to attach'
913
-                                        + ' video stream');
935
+                                if (video && !$(element).is(':visible')) {
936
+                                    throw new Error(
937
+                                        'video element must be visible to'
938
+                                            + ' attach video stream');
939
+                                }
914 940
                             }
915
-                        }
916 941
 
917
-                        return attachMediaStream(element, stream);
918
-                    });
942
+                            return attachMediaStream(element, stream);
943
+                        });
919 944
                     this.getStreamID
920 945
                         = stream => SDPUtil.filter_special_chars(stream.label);
921 946
 
@@ -975,7 +1000,11 @@ class RTCUtils extends Listenable {
975 1000
     * @param {string} options.cameraDeviceId
976 1001
     * @param {string} options.micDeviceId
977 1002
     **/
978
-    getUserMediaWithConstraints(um, success_callback, failure_callback, options) {
1003
+    getUserMediaWithConstraints(
1004
+            um,
1005
+            success_callback,
1006
+            failure_callback,
1007
+            options) {
979 1008
         options = options || {};
980 1009
         const constraints = getConstraints(um, options);
981 1010
 
@@ -1013,9 +1042,10 @@ class RTCUtils extends Listenable {
1013 1042
      * @param {Object} [options] optional parameters
1014 1043
      * @param {Array} options.devices the devices that will be requested
1015 1044
      * @param {string} options.resolution resolution constraints
1016
-     * @param {bool} options.dontCreateJitsiTrack if <tt>true</tt> objects with the following structure {stream: the Media Stream,
1017
-     * type: "audio" or "video", videoType: "camera" or "desktop"}
1018
-     * will be returned trough the Promise, otherwise JitsiTrack objects will be returned.
1045
+     * @param {bool} options.dontCreateJitsiTrack if <tt>true</tt> objects with
1046
+     * the following structure {stream: the Media Stream, type: "audio" or
1047
+     * "video", videoType: "camera" or "desktop"} will be returned trough the
1048
+     * Promise, otherwise JitsiTrack objects will be returned.
1019 1049
      * @param {string} options.cameraDeviceId
1020 1050
      * @param {string} options.micDeviceId
1021 1051
      * @returns {*} Promise object that will receive the new JitsiTracks
@@ -1062,14 +1092,14 @@ class RTCUtils extends Listenable {
1062 1092
                         dsOptions);
1063 1093
                 }
1064 1094
 
1065
-                // With FF/IE we can't split the stream into audio and video because FF
1066
-                // doesn't support media stream constructors. So, we need to get the
1067
-                // audio stream separately from the video stream using two distinct GUM
1068
-                // calls. Not very user friendly :-( but we don't have many other
1069
-                // options neither.
1095
+                // With FF/IE we can't split the stream into audio and video
1096
+                // because FF doesn't support media stream constructors. So, we
1097
+                // need to get the audio stream separately from the video stream
1098
+                // using two distinct GUM calls. Not very user friendly :-( but
1099
+                // we don't have many other options neither.
1070 1100
                 //
1071
-                // Note that we pack those 2 streams in a single object and pass it to
1072
-                // the successCallback method.
1101
+                // Note that we pack those 2 streams in a single object and pass
1102
+                // it to the successCallback method.
1073 1103
                 obtainDevices({
1074 1104
                     devices: options.devices,
1075 1105
                     streams: [],
@@ -1081,7 +1111,9 @@ class RTCUtils extends Listenable {
1081 1111
                 const hasDesktop = options.devices.indexOf('desktop') > -1;
1082 1112
 
1083 1113
                 if (hasDesktop) {
1084
-                    options.devices.splice(options.devices.indexOf('desktop'), 1);
1114
+                    options.devices.splice(
1115
+                        options.devices.indexOf('desktop'),
1116
+                        1);
1085 1117
                 }
1086 1118
                 options.resolution = options.resolution || '360';
1087 1119
                 if (options.devices.length) {
@@ -1098,7 +1130,8 @@ class RTCUtils extends Listenable {
1098 1130
                                 = stream.getVideoTracks().length > 0;
1099 1131
 
1100 1132
                             if ((audioDeviceRequested && !audioTracksReceived)
1101
-                                || (videoDeviceRequested && !videoTracksReceived)) {
1133
+                                    || (videoDeviceRequested
1134
+                                        && !videoTracksReceived)) {
1102 1135
                                 self.stopMediaStream(stream);
1103 1136
 
1104 1137
                                 // We are getting here in case if we requested
@@ -1108,11 +1141,13 @@ class RTCUtils extends Listenable {
1108 1141
                                 // this happened, so reject with general error.
1109 1142
                                 const devices = [];
1110 1143
 
1111
-                                if (audioDeviceRequested && !audioTracksReceived) {
1144
+                                if (audioDeviceRequested
1145
+                                        && !audioTracksReceived) {
1112 1146
                                     devices.push('audio');
1113 1147
                                 }
1114 1148
 
1115
-                                if (videoDeviceRequested && !videoTracksReceived) {
1149
+                                if (videoDeviceRequested
1150
+                                        && !videoTracksReceived) {
1116 1151
                                     devices.push('video');
1117 1152
                                 }
1118 1153
 
@@ -1135,7 +1170,8 @@ class RTCUtils extends Listenable {
1135 1170
                                         reject(new JitsiTrackError(
1136 1171
                                             { name: 'UnknownError' },
1137 1172
                                             getConstraints(
1138
-                                                options.devices, options),
1173
+                                                options.devices,
1174
+                                                options),
1139 1175
                                             devices)
1140 1176
                                         );
1141 1177
                                     },

+ 22
- 12
modules/RTC/TraceablePeerConnection.js View File

@@ -228,7 +228,8 @@ const dumpSDP = function(description) {
228 228
 TraceablePeerConnection.prototype._remoteStreamAdded = function(stream) {
229 229
     if (!RTC.isUserStream(stream)) {
230 230
         logger.info(
231
-            'Ignored remote \'stream added\' event for non-user stream', stream);
231
+            'Ignored remote \'stream added\' event for non-user stream',
232
+            stream);
232 233
 
233 234
         return;
234 235
     }
@@ -545,7 +546,8 @@ const normalizePlanB = function(desc) {
545 546
     const session = transform.parse(desc.sdp);
546 547
 
547 548
     if (typeof session !== 'undefined'
548
-        && typeof session.media !== 'undefined' && Array.isArray(session.media)) {
549
+            && typeof session.media !== 'undefined'
550
+            && Array.isArray(session.media)) {
549 551
         session.media.forEach(mLine => {
550 552
 
551 553
             // Chrome appears to be picky about the order in which a=ssrc lines
@@ -696,9 +698,11 @@ TraceablePeerConnection.prototype.createDataChannel = function(label, opts) {
696 698
 
697 699
 TraceablePeerConnection.prototype.setLocalDescription
698 700
         = function(description, successCallback, failureCallback) {
699
-            this.trace('setLocalDescription::preTransform', dumpSDP(description));
701
+            this.trace(
702
+                'setLocalDescription::preTransform',
703
+                dumpSDP(description));
700 704
 
701
-    // if we're running on FF, transform to Plan A first.
705
+            // if we're running on FF, transform to Plan A first.
702 706
             if (RTCBrowserType.usesUnifiedPlan()) {
703 707
                 description = this.interop.toUnifiedPlan(description);
704 708
                 this.trace('setLocalDescription::postTransform (Plan A)',
@@ -724,26 +728,31 @@ TraceablePeerConnection.prototype.setLocalDescription
724 728
 
725 729
 TraceablePeerConnection.prototype.setRemoteDescription
726 730
         = function(description, successCallback, failureCallback) {
727
-            this.trace('setRemoteDescription::preTransform', dumpSDP(description));
731
+            this.trace(
732
+                'setRemoteDescription::preTransform',
733
+                dumpSDP(description));
728 734
 
729
-    // TODO the focus should squeze or explode the remote simulcast
735
+            // TODO the focus should squeze or explode the remote simulcast
730 736
             description = this.simulcast.mungeRemoteDescription(description);
731 737
             this.trace(
732
-        'setRemoteDescription::postTransform (simulcast)',
733
-        dumpSDP(description));
738
+                'setRemoteDescription::postTransform (simulcast)',
739
+                dumpSDP(description));
734 740
 
735 741
             if (this.options.preferH264) {
736 742
                 const parsedSdp = transform.parse(description.sdp);
737
-                const videoMLine = parsedSdp.media.find(m => m.type === 'video');
743
+                const videoMLine
744
+                    = parsedSdp.media.find(m => m.type === 'video');
738 745
 
739 746
                 SDPUtil.preferVideoCodec(videoMLine, 'h264');
740 747
                 description.sdp = transform.write(parsedSdp);
741 748
             }
742 749
 
743
-    // if we're running on FF, transform to Plan A first.
750
+            // if we're running on FF, transform to Plan A first.
744 751
             if (RTCBrowserType.usesUnifiedPlan()) {
745 752
                 description.sdp = this.rtxModifier.stripRtx(description.sdp);
746
-                this.trace('setRemoteDescription::postTransform (stripRtx)', dumpSDP(description));
753
+                this.trace(
754
+                    'setRemoteDescription::postTransform (stripRtx)',
755
+                    dumpSDP(description));
747 756
                 description = this.interop.toUnifiedPlan(description);
748 757
                 this.trace(
749 758
             'setRemoteDescription::postTransform (Plan A)',
@@ -900,7 +909,8 @@ TraceablePeerConnection.prototype.createAnswer
900 909
                         = this.sdpConsistency.makeVideoPrimarySsrcsConsistent(
901 910
                             answer.sdp);
902 911
                     this.trace(
903
-                        'createAnswerOnSuccess::postTransform (make primary video ssrcs consistent)',
912
+                        'createAnswerOnSuccess::postTransform (make primary'
913
+                          + ' video ssrcs consistent)',
904 914
                         dumpSDP(answer));
905 915
                 }
906 916
 

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

@@ -66,7 +66,8 @@ KEYS_BY_BROWSER_TYPE[RTCBrowserType.RTC_BROWSER_REACT_NATIVE]
66 66
  * @returns {number} packet loss percent
67 67
  */
68 68
 function calculatePacketLoss(lostPackets, totalPackets) {
69
-    if (!totalPackets || totalPackets <= 0 || !lostPackets || lostPackets <= 0) {
69
+    if (!totalPackets || totalPackets <= 0
70
+            || !lostPackets || lostPackets <= 0) {
70 71
         return 0;
71 72
     }
72 73
 
@@ -517,7 +518,8 @@ StatsCollector.prototype.processStatsReport = function() {
517 518
 
518 519
         const bytesReceivedNow = getNonNegativeStat(now, 'bytesReceived');
519 520
         const bytesReceivedBefore = getNonNegativeStat(before, 'bytesReceived');
520
-        const bytesReceived = Math.max(0, bytesReceivedNow - bytesReceivedBefore);
521
+        const bytesReceived
522
+            = Math.max(0, bytesReceivedNow - bytesReceivedBefore);
521 523
 
522 524
         let bytesSent = 0;
523 525
 

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

@@ -168,7 +168,9 @@ Statistics.prototype.addConnectionStatsListener = function(listener) {
168 168
 };
169 169
 
170 170
 Statistics.prototype.removeConnectionStatsListener = function(listener) {
171
-    this.eventEmitter.removeListener(StatisticsEvents.CONNECTION_STATS, listener);
171
+    this.eventEmitter.removeListener(
172
+        StatisticsEvents.CONNECTION_STATS,
173
+        listener);
172 174
 };
173 175
 
174 176
 Statistics.prototype.addByteSentStatsListener = function(listener) {

+ 137
- 68
modules/xmpp/ChatRoom.js View File

@@ -93,9 +93,11 @@ export default class ChatRoom extends Listenable {
93 93
         this.focusMucJid = null;
94 94
         this.noBridgeAvailable = false;
95 95
         this.options = options || {};
96
-        this.moderator = new Moderator(this.roomjid, this.xmpp, this.eventEmitter,
97
-            { connection: this.xmpp.options,
98
-                conference: this.options });
96
+        this.moderator
97
+            = new Moderator(this.roomjid, this.xmpp, this.eventEmitter, {
98
+                connection: this.xmpp.options,
99
+                conference: this.options
100
+            });
99 101
         this.initPresenceMap();
100 102
         this.lastPresences = {};
101 103
         this.phoneNumber = null;
@@ -116,8 +118,9 @@ export default class ChatRoom extends Listenable {
116 118
             'attributes': { xmlns: 'http://jitsi.org/jitmeet/user-agent' }
117 119
         });
118 120
 
119
-        // We need to broadcast 'videomuted' status from the beginning, cause Jicofo
120
-        // makes decisions based on that. Initialize it with 'false' here.
121
+        // We need to broadcast 'videomuted' status from the beginning, cause
122
+        // Jicofo makes decisions based on that. Initialize it with 'false'
123
+        // here.
121 124
         this.addVideoInfoToPresence(false);
122 125
     }
123 126
 
@@ -153,10 +156,10 @@ export default class ChatRoom extends Listenable {
153 156
         const pres = $pres({ to });
154 157
 
155 158
         // xep-0045 defines: "including in the initial presence stanza an empty
156
-        // <x/> element qualified by the 'http://jabber.org/protocol/muc' namespace"
157
-        // and subsequent presences should not include that or it can be considered
158
-        // as joining, and server can send us the message history for the room on
159
-        // every presence
159
+        // <x/> element qualified by the 'http://jabber.org/protocol/muc'
160
+        // namespace" and subsequent presences should not include that or it can
161
+        // be considered as joining, and server can send us the message history
162
+        // for the room on every presence
160 163
         if (fromJoin) {
161 164
             pres.c('x', { xmlns: this.presMap.xns });
162 165
 
@@ -171,8 +174,8 @@ export default class ChatRoom extends Listenable {
171 174
         if (fromJoin) {
172 175
             // XXX We're pressed for time here because we're beginning a complex
173 176
             // and/or lengthy conference-establishment process which supposedly
174
-            // involves multiple RTTs. We don't have the time to wait for Strophe to
175
-            // decide to send our IQ.
177
+            // involves multiple RTTs. We don't have the time to wait for
178
+            // Strophe to decide to send our IQ.
176 179
             this.connection.flush();
177 180
         }
178 181
     }
@@ -189,16 +192,17 @@ export default class ChatRoom extends Listenable {
189 192
         this.presMap.length = 0;
190 193
 
191 194
         // XXX Strophe is asynchronously sending by default. Unfortunately, that
192
-        // means that there may not be enough time to send the unavailable presence.
193
-        // Switching Strophe to synchronous sending is not much of an option because
194
-        // it may lead to a noticeable delay in navigating away from the current
195
-        // location. As a compromise, we will try to increase the chances of sending
196
-        // the unavailable presence within the short time span that we have upon
197
-        // unloading by invoking flush() on the connection. We flush() once before
198
-        // sending/queuing the unavailable presence in order to attemtp to have the
199
-        // unavailable presence at the top of the send queue. We flush() once more
200
-        // after sending/queuing the unavailable presence in order to attempt to
201
-        // have it sent as soon as possible.
195
+        // means that there may not be enough time to send the unavailable
196
+        // presence. Switching Strophe to synchronous sending is not much of an
197
+        // option because it may lead to a noticeable delay in navigating away
198
+        // from the current location. As a compromise, we will try to increase
199
+        // the chances of sending the unavailable presence within the short time
200
+        // span that we have upon unloading by invoking flush() on the
201
+        // connection. We flush() once before sending/queuing the unavailable
202
+        // presence in order to attemtp to have the unavailable presence at the
203
+        // top of the send queue. We flush() once more after sending/queuing the
204
+        // unavailable presence in order to attempt to have it sent as soon as
205
+        // possible.
202 206
         this.connection.flush();
203 207
         this.connection.send(pres);
204 208
         this.connection.flush();
@@ -323,11 +327,14 @@ export default class ChatRoom extends Listenable {
323 327
         }
324 328
 
325 329
         if (from == this.myroomjid) {
326
-            const newRole = member.affiliation == 'owner' ? member.role : 'none';
330
+            const newRole
331
+                = member.affiliation == 'owner' ? member.role : 'none';
327 332
 
328 333
             if (this.role !== newRole) {
329 334
                 this.role = newRole;
330
-                this.eventEmitter.emit(XMPPEvents.LOCAL_ROLE_CHANGED, this.role);
335
+                this.eventEmitter.emit(
336
+                    XMPPEvents.LOCAL_ROLE_CHANGED,
337
+                    this.role);
331 338
             }
332 339
             if (!this.joined) {
333 340
                 this.joined = true;
@@ -367,13 +374,14 @@ export default class ChatRoom extends Listenable {
367 374
 
368 375
             if (member.isFocus) {
369 376
                 // From time to time first few presences of the focus are not
370
-                // containing it's jid. That way we can mark later the focus member
371
-                // instead of not marking it at all and not starting the conference.
372
-                // FIXME: Maybe there is a better way to handle this issue. It seems
373
-                // there is some period of time in prosody that the configuration
374
-                // form is received but not applied. And if any participant joins
375
-                // during that period of time the first presence from the focus
376
-                // won't conain <item jid="focus..." />.
377
+                // containing it's jid. That way we can mark later the focus
378
+                // member instead of not marking it at all and not starting the
379
+                // conference.
380
+                // FIXME: Maybe there is a better way to handle this issue. It
381
+                // seems there is some period of time in prosody that the
382
+                // configuration form is received but not applied. And if any
383
+                // participant joins during that period of time the first
384
+                // presence from the focus won't conain <item jid="focus..." />.
377 385
                 memberOfThis.isFocus = true;
378 386
                 this._initFocus(from, jid);
379 387
             }
@@ -397,7 +405,9 @@ export default class ChatRoom extends Listenable {
397 405
 
398 406
                     if (displayName && displayName.length > 0) {
399 407
                         this.eventEmitter.emit(
400
-                                XMPPEvents.DISPLAY_NAME_CHANGED, from, displayName);
408
+                            XMPPEvents.DISPLAY_NAME_CHANGED,
409
+                            from,
410
+                            displayName);
401 411
                     }
402 412
                 }
403 413
                 break;
@@ -461,8 +471,8 @@ export default class ChatRoom extends Listenable {
461 471
     }
462 472
 
463 473
     /**
464
-     * Sets the special listener to be used for "command"s whose name starts with
465
-     * "jitsi_participant_".
474
+     * Sets the special listener to be used for "command"s whose name starts
475
+     * with "jitsi_participant_".
466 476
      */
467 477
     setParticipantPropertyListener(listener) {
468 478
         this.participantPropertyListener = listener;
@@ -493,7 +503,10 @@ export default class ChatRoom extends Listenable {
493 503
 
494 504
         msg.c('body', body).up();
495 505
         if (nickname) {
496
-            msg.c('nick', { xmlns: 'http://jabber.org/protocol/nick' }).t(nickname).up().up();
506
+            msg.c('nick', { xmlns: 'http://jabber.org/protocol/nick' })
507
+                .t(nickname)
508
+                .up()
509
+                .up();
497 510
         }
498 511
         this.connection.send(msg);
499 512
         this.eventEmitter.emit(XMPPEvents.SENDING_CHAT_MESSAGE, body);
@@ -548,12 +561,20 @@ export default class ChatRoom extends Listenable {
548 561
         }
549 562
 
550 563
         // Status code 110 indicates that this notification is "self-presence".
551
-        const isSelfPresence = $(pres).find(
552
-                '>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="110"]'
553
-            ).length !== 0;
554
-        const isKick = $(pres).find(
555
-                '>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="307"]'
556
-            ).length !== 0;
564
+        const isSelfPresence
565
+            = $(pres)
566
+                    .find(
567
+                        '>x[xmlns="http://jabber.org/protocol/muc#user"]>'
568
+                            + 'status[code="110"]')
569
+                    .length
570
+                !== 0;
571
+        const isKick
572
+            = $(pres)
573
+                    .find(
574
+                        '>x[xmlns="http://jabber.org/protocol/muc#user"]'
575
+                            + '>status[code="307"]')
576
+                    .length
577
+                !== 0;
557 578
         const membersKeys = Object.keys(this.members);
558 579
 
559 580
         if (!isSelfPresence) {
@@ -620,13 +641,19 @@ export default class ChatRoom extends Listenable {
620 641
 
621 642
             if (stamp) {
622 643
                 // the format is CCYYMMDDThh:mm:ss
623
-                const dateParts = stamp.match(/(\d{4})(\d{2})(\d{2}T\d{2}:\d{2}:\d{2})/);
644
+                const dateParts
645
+                    = stamp.match(/(\d{4})(\d{2})(\d{2}T\d{2}:\d{2}:\d{2})/);
624 646
 
625 647
                 stamp = `${dateParts[1]}-${dateParts[2]}-${dateParts[3]}Z`;
626 648
             }
627 649
         }
628 650
 
629
-        if (from == this.roomjid && $(msg).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="104"]').length) {
651
+        if (from == this.roomjid
652
+                && $(msg)
653
+                    .find(
654
+                        '>x[xmlns="http://jabber.org/protocol/muc#user"]'
655
+                            + '>status[code="104"]')
656
+                    .length) {
630 657
             this.discoRoomInfo();
631 658
         }
632 659
 
@@ -638,11 +665,20 @@ export default class ChatRoom extends Listenable {
638 665
     }
639 666
 
640 667
     onPresenceError(pres, from) {
641
-        if ($(pres).find('>error[type="auth"]>not-authorized[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length) {
668
+        if ($(pres)
669
+                .find(
670
+                    '>error[type="auth"]'
671
+                        + '>not-authorized['
672
+                        + 'xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]')
673
+                .length) {
642 674
             logger.log('on password required', from);
643 675
             this.eventEmitter.emit(XMPPEvents.PASSWORD_REQUIRED);
644
-        } else if ($(pres).find(
645
-            '>error[type="cancel"]>not-allowed[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length) {
676
+        } else if ($(pres)
677
+                .find(
678
+                    '>error[type="cancel"]'
679
+                        + '>not-allowed['
680
+                        + 'xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]')
681
+                .length) {
646 682
             const toDomain = Strophe.getDomainFromJid(pres.getAttribute('to'));
647 683
 
648 684
             if (toDomain === this.xmpp.options.hosts.anonymousdomain) {
@@ -654,7 +690,8 @@ export default class ChatRoom extends Listenable {
654 690
 
655 691
             } else {
656 692
                 logger.warn('onPresError ', pres);
657
-                this.eventEmitter.emit(XMPPEvents.ROOM_CONNECT_NOT_ALLOWED_ERROR);
693
+                this.eventEmitter.emit(
694
+                    XMPPEvents.ROOM_CONNECT_NOT_ALLOWED_ERROR);
658 695
             }
659 696
         } else if ($(pres).find('>error>service-unavailable').length) {
660 697
             logger.warn('Maximum users limit for the room has been reached',
@@ -683,22 +720,51 @@ export default class ChatRoom extends Listenable {
683 720
     lockRoom(key, onSuccess, onError, onNotSupported) {
684 721
         // http://xmpp.org/extensions/xep-0045.html#roomconfig
685 722
         this.connection.sendIQ(
686
-            $iq({ to: this.roomjid,
687
-                type: 'get' }).c('query', { xmlns: 'http://jabber.org/protocol/muc#owner' }),
723
+            $iq({
724
+                to: this.roomjid,
725
+                type: 'get'
726
+            })
727
+                .c('query', { xmlns: 'http://jabber.org/protocol/muc#owner' }),
688 728
             res => {
689
-                if ($(res).find('>query>x[xmlns="jabber:x:data"]>field[var="muc#roomconfig_roomsecret"]').length) {
729
+                if ($(res)
730
+                        .find(
731
+                            '>query>x[xmlns="jabber:x:data"]'
732
+                                + '>field[var="muc#roomconfig_roomsecret"]')
733
+                        .length) {
690 734
                     const formsubmit
691
-                        = $iq({ to: this.roomjid,
692
-                            type: 'set' })
693
-                            .c('query', { xmlns: 'http://jabber.org/protocol/muc#owner' });
694
-
695
-                    formsubmit.c('x', { xmlns: 'jabber:x:data',
696
-                        type: 'submit' });
697
-                    formsubmit.c('field', { 'var': 'FORM_TYPE' }).c('value').t('http://jabber.org/protocol/muc#roomconfig').up().up();
698
-                    formsubmit.c('field', { 'var': 'muc#roomconfig_roomsecret' }).c('value').t(key).up().up();
699
-
700
-                    // Fixes a bug in prosody 0.9.+ https://code.google.com/p/lxmppd/issues/detail?id=373
701
-                    formsubmit.c('field', { 'var': 'muc#roomconfig_whois' }).c('value').t('anyone').up().up();
735
+                        = $iq({
736
+                            to: this.roomjid,
737
+                            type: 'set'
738
+                        })
739
+                            .c('query', {
740
+                                xmlns: 'http://jabber.org/protocol/muc#owner'
741
+                            });
742
+
743
+                    formsubmit.c('x', {
744
+                        xmlns: 'jabber:x:data',
745
+                        type: 'submit'
746
+                    });
747
+                    formsubmit
748
+                        .c('field', { 'var': 'FORM_TYPE' })
749
+                        .c('value')
750
+                        .t('http://jabber.org/protocol/muc#roomconfig')
751
+                        .up()
752
+                        .up();
753
+                    formsubmit
754
+                        .c('field', { 'var': 'muc#roomconfig_roomsecret' })
755
+                        .c('value')
756
+                        .t(key)
757
+                        .up()
758
+                        .up();
759
+
760
+                    // Fixes a bug in prosody 0.9.+
761
+                    // https://code.google.com/p/lxmppd/issues/detail?id=373
762
+                    formsubmit
763
+                        .c('field', { 'var': 'muc#roomconfig_whois' })
764
+                        .c('value')
765
+                        .t('anyone')
766
+                        .up()
767
+                        .up();
702 768
 
703 769
                     // FIXME: is muc#roomconfig_passwordprotectedroom required?
704 770
                     this.connection.sendIQ(formsubmit, onSuccess, onError);
@@ -733,8 +799,8 @@ export default class ChatRoom extends Listenable {
733 799
      * Checks if the user identified by given <tt>mucJid</tt> is the conference
734 800
      * focus.
735 801
      * @param mucJid the full MUC address of the user to be checked.
736
-     * @returns {boolean|null} <tt>true</tt> if MUC user is the conference focus or
737
-     * <tt>false</tt> if is not. When given <tt>mucJid</tt> does not exist in
802
+     * @returns {boolean|null} <tt>true</tt> if MUC user is the conference focus
803
+     * or <tt>false</tt> if is not. When given <tt>mucJid</tt> does not exist in
738 804
      * the MUC then <tt>null</tt> is returned.
739 805
      */
740 806
     isFocus(mucJid) {
@@ -861,8 +927,8 @@ export default class ChatRoom extends Listenable {
861 927
     }
862 928
 
863 929
     /**
864
-     * Returns null if the recording is not supported, "on" if the recording started
865
-     * and "off" if the recording is not started.
930
+     * Returns null if the recording is not supported, "on" if the recording
931
+     * started and "off" if the recording is not started.
866 932
      */
867 933
     getRecordingState() {
868 934
         return this.recording ? this.recording.getState() : undefined;
@@ -878,7 +944,8 @@ export default class ChatRoom extends Listenable {
878 944
     /**
879 945
      * Starts/stops the recording
880 946
      * @param token token for authentication
881
-     * @param statusChangeHandler {function} receives the new status as argument.
947
+     * @param statusChangeHandler {function} receives the new status as
948
+     * argument.
882 949
      */
883 950
     toggleRecording(options, statusChangeHandler) {
884 951
         if (this.recording) {
@@ -967,7 +1034,9 @@ export default class ChatRoom extends Listenable {
967 1034
         if (mute.length) {
968 1035
             const doMuteAudio = mute.text() === 'true';
969 1036
 
970
-            this.eventEmitter.emit(XMPPEvents.AUDIO_MUTED_BY_FOCUS, doMuteAudio);
1037
+            this.eventEmitter.emit(
1038
+                XMPPEvents.AUDIO_MUTED_BY_FOCUS,
1039
+                doMuteAudio);
971 1040
         }
972 1041
 
973 1042
         return true;
@@ -975,8 +1044,8 @@ export default class ChatRoom extends Listenable {
975 1044
 
976 1045
     /**
977 1046
      * Leaves the room. Closes the jingle session.
978
-     * @returns {Promise} which is resolved if XMPPEvents.MUC_LEFT is received less
979
-     * than 5s after sending presence unavailable. Otherwise the promise is
1047
+     * @returns {Promise} which is resolved if XMPPEvents.MUC_LEFT is received
1048
+     * less than 5s after sending presence unavailable. Otherwise the promise is
980 1049
      * rejected.
981 1050
      */
982 1051
     leave() {

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

@@ -779,7 +779,8 @@ export default class JingleSessionPC extends JingleSession {
779 779
                     finishedCallback();
780 780
                 }, error => {
781 781
                     logger.error(
782
-                        `Error renegotiating after processing remote source-add: ${error}`);
782
+                        'Error renegotiating after processing remote'
783
+                            + ` source-add: ${error}`);
783 784
                     finishedCallback(error);
784 785
                 });
785 786
         };
@@ -823,7 +824,8 @@ export default class JingleSessionPC extends JingleSession {
823 824
                     finishedCallback();
824 825
                 }, error => {
825 826
                     logger.error(
826
-                        `Error renegotiating after processing remote source-remove: ${error}`);
827
+                        'Error renegotiating after processing remote'
828
+                          + ` source-remove: ${error}`);
827 829
                     finishedCallback(error);
828 830
                 });
829 831
         };
@@ -954,7 +956,9 @@ export default class JingleSessionPC extends JingleSession {
954 956
                 remoteDescription,
955 957
                 () => {
956 958
                     if (this.signalingState === 'closed') {
957
-                        reject('Attempted to setRemoteDescription in state closed');
959
+                        reject(
960
+                            'Attempted to setRemoteDescription in state'
961
+                                + ' closed');
958 962
 
959 963
                         return;
960 964
                     }
@@ -1165,7 +1169,8 @@ export default class JingleSessionPC extends JingleSession {
1165 1169
         const workFunction = finishedCallback => {
1166 1170
             if (!this.peerconnection) {
1167 1171
                 finishedCallback(
1168
-                    'Error: tried adding stream with no active peer connection');
1172
+                    'Error: tried adding stream with no active peer'
1173
+                        + ' connection');
1169 1174
 
1170 1175
                 return;
1171 1176
             }

+ 121
- 61
modules/xmpp/SDP.js View File

@@ -51,7 +51,10 @@ SDP.prototype.getMediaSsrcMap = function() {
51 51
 
52 52
     for (let mediaindex = 0; mediaindex < self.media.length; mediaindex++) {
53 53
         tmp = SDPUtil.find_lines(self.media[mediaindex], 'a=ssrc:');
54
-        const mid = SDPUtil.parse_mid(SDPUtil.find_line(self.media[mediaindex], 'a=mid:'));
54
+        const mid
55
+            = SDPUtil.parse_mid(
56
+                SDPUtil.find_line(self.media[mediaindex],
57
+                'a=mid:'));
55 58
         const media = {
56 59
             mediaindex,
57 60
             mid,
@@ -223,11 +226,18 @@ SDP.prototype.toJingle = function(elem, thecreator) {
223 226
                 elem.attrs({ ssrc });
224 227
             }
225 228
             for (j = 0; j < mline.fmt.length; j++) {
226
-                rtpmap = SDPUtil.find_line(this.media[i], `a=rtpmap:${mline.fmt[j]}`);
229
+                rtpmap
230
+                    = SDPUtil.find_line(
231
+                        this.media[i],
232
+                        `a=rtpmap:${mline.fmt[j]}`);
227 233
                 elem.c('payload-type', SDPUtil.parse_rtpmap(rtpmap));
228 234
 
229
-                // put any 'a=fmtp:' + mline.fmt[j] lines into <param name=foo value=bar/>
230
-                const afmtpline = SDPUtil.find_line(this.media[i], `a=fmtp:${mline.fmt[j]}`);
235
+                // put any 'a=fmtp:' + mline.fmt[j] lines into <param name=foo
236
+                // value=bar/>
237
+                const afmtpline
238
+                    = SDPUtil.find_line(
239
+                        this.media[i],
240
+                        `a=fmtp:${mline.fmt[j]}`);
231 241
 
232 242
                 if (afmtpline) {
233 243
                     tmp = SDPUtil.parse_fmtp(afmtpline);
@@ -235,11 +245,14 @@ SDP.prototype.toJingle = function(elem, thecreator) {
235 245
                         elem.c('parameter', tmp[k]).up();
236 246
                     }
237 247
                 }
238
-                this.rtcpFbToJingle(i, elem, mline.fmt[j]); // XEP-0293 -- map a=rtcp-fb
248
+
249
+                // XEP-0293 -- map a=rtcp-fb
250
+                this.rtcpFbToJingle(i, elem, mline.fmt[j]);
239 251
 
240 252
                 elem.up();
241 253
             }
242
-            const crypto = SDPUtil.find_lines(this.media[i], 'a=crypto:', this.session);
254
+            const crypto
255
+                = SDPUtil.find_lines(this.media[i], 'a=crypto:', this.session);
243 256
 
244 257
             if (crypto.length) {
245 258
                 elem.c('encryption', { required: 1 });
@@ -327,7 +340,8 @@ SDP.prototype.toJingle = function(elem, thecreator) {
327 340
                 elem.up();
328 341
 
329 342
                 // XEP-0339 handle ssrc-group attributes
330
-                const ssrc_group_lines = SDPUtil.find_lines(this.media[i], 'a=ssrc-group:');
343
+                const ssrc_group_lines
344
+                    = SDPUtil.find_lines(this.media[i], 'a=ssrc-group:');
331 345
 
332 346
                 ssrc_group_lines.forEach(line => {
333 347
                     const idx = line.indexOf(' ');
@@ -355,9 +369,11 @@ SDP.prototype.toJingle = function(elem, thecreator) {
355 369
             if (lines.length) {
356 370
                 for (j = 0; j < lines.length; j++) {
357 371
                     tmp = SDPUtil.parse_extmap(lines[j]);
358
-                    elem.c('rtp-hdrext', { xmlns: 'urn:xmpp:jingle:apps:rtp:rtp-hdrext:0',
372
+                    elem.c('rtp-hdrext', {
373
+                        xmlns: 'urn:xmpp:jingle:apps:rtp:rtp-hdrext:0',
359 374
                         uri: tmp.uri,
360
-                        id: tmp.value });
375
+                        id: tmp.value
376
+                    });
361 377
                     if (tmp.hasOwnProperty('direction')) {
362 378
                         switch (tmp.direction) {
363 379
                         case 'sendonly':
@@ -385,13 +401,15 @@ SDP.prototype.toJingle = function(elem, thecreator) {
385 401
         // map ice-ufrag/pwd, dtls fingerprint, candidates
386 402
         this.transportToJingle(i, elem);
387 403
 
388
-        if (SDPUtil.find_line(this.media[i], 'a=sendrecv', this.session)) {
404
+        const m = this.media[i];
405
+
406
+        if (SDPUtil.find_line(m, 'a=sendrecv', this.session)) {
389 407
             elem.attrs({ senders: 'both' });
390
-        } else if (SDPUtil.find_line(this.media[i], 'a=sendonly', this.session)) {
408
+        } else if (SDPUtil.find_line(m, 'a=sendonly', this.session)) {
391 409
             elem.attrs({ senders: 'initiator' });
392
-        } else if (SDPUtil.find_line(this.media[i], 'a=recvonly', this.session)) {
410
+        } else if (SDPUtil.find_line(m, 'a=recvonly', this.session)) {
393 411
             elem.attrs({ senders: 'responder' });
394
-        } else if (SDPUtil.find_line(this.media[i], 'a=inactive', this.session)) {
412
+        } else if (SDPUtil.find_line(m, 'a=inactive', this.session)) {
395 413
             elem.attrs({ senders: 'none' });
396 414
         }
397 415
         if (mline.port == '0') {
@@ -433,14 +451,21 @@ SDP.prototype.transportToJingle = function(mediaindex, elem) {
433 451
 
434 452
     // XEP-0320
435 453
     const fingerprints
436
-        = SDPUtil.find_lines(this.media[mediaindex], 'a=fingerprint:', this.session);
454
+        = SDPUtil.find_lines(
455
+            this.media[mediaindex],
456
+            'a=fingerprint:',
457
+            this.session);
437 458
 
438 459
     fingerprints.forEach(line => {
439 460
         tmp = SDPUtil.parse_fingerprint(line);
440 461
         tmp.xmlns = 'urn:xmpp:jingle:apps:dtls:0';
441 462
         elem.c('fingerprint').t(tmp.fingerprint);
442 463
         delete tmp.fingerprint;
443
-        line = SDPUtil.find_line(self.media[mediaindex], 'a=setup:', self.session);
464
+        line
465
+            = SDPUtil.find_line(
466
+                self.media[mediaindex],
467
+                'a=setup:',
468
+                self.session);
444 469
         if (line) {
445 470
             tmp.setup = line.substr(8);
446 471
         }
@@ -453,18 +478,23 @@ SDP.prototype.transportToJingle = function(mediaindex, elem) {
453 478
         elem.attrs(tmp);
454 479
 
455 480
         // XEP-0176
456
-        if (SDPUtil.find_line(this.media[mediaindex], 'a=candidate:', this.session)) { // add any a=candidate lines
457
-            const lines = SDPUtil.find_lines(this.media[mediaindex], 'a=candidate:', this.session);
481
+        const lines
482
+            = SDPUtil.find_lines(
483
+                this.media[mediaindex],
484
+                'a=candidate:',
485
+                this.session);
458 486
 
487
+        if (lines.length) { // add any a=candidate lines
459 488
             lines.forEach(line => {
460 489
                 const candidate = SDPUtil.candidateToJingle(line);
461 490
 
462 491
                 if (self.failICE) {
463 492
                     candidate.ip = '1.1.1.1';
464 493
                 }
465
-                const protocol = candidate
466
-                        && typeof candidate.protocol === 'string'
467
-                    ? candidate.protocol.toLowerCase() : '';
494
+                const protocol
495
+                    = candidate && typeof candidate.protocol === 'string'
496
+                        ? candidate.protocol.toLowerCase()
497
+                        : '';
468 498
 
469 499
                 if ((self.removeTcpCandidates
470 500
                         && (protocol === 'tcp' || protocol === 'ssltcp'))
@@ -478,19 +508,27 @@ SDP.prototype.transportToJingle = function(mediaindex, elem) {
478 508
     elem.up(); // end of transport
479 509
 };
480 510
 
481
-SDP.prototype.rtcpFbToJingle = function(mediaindex, elem, payloadtype) { // XEP-0293
482
-    const lines = SDPUtil.find_lines(this.media[mediaindex], `a=rtcp-fb:${payloadtype}`);
511
+// XEP-0293
512
+SDP.prototype.rtcpFbToJingle = function(mediaindex, elem, payloadtype) {
513
+    const lines
514
+        = SDPUtil.find_lines(
515
+            this.media[mediaindex],
516
+            `a=rtcp-fb:${payloadtype}`);
483 517
 
484 518
     lines.forEach(line => {
485 519
         const tmp = SDPUtil.parse_rtcpfb(line);
486 520
 
487 521
         if (tmp.type == 'trr-int') {
488
-            elem.c('rtcp-fb-trr-int', { xmlns: 'urn:xmpp:jingle:apps:rtp:rtcp-fb:0',
489
-                value: tmp.params[0] });
522
+            elem.c('rtcp-fb-trr-int', {
523
+                xmlns: 'urn:xmpp:jingle:apps:rtp:rtcp-fb:0',
524
+                value: tmp.params[0]
525
+            });
490 526
             elem.up();
491 527
         } else {
492
-            elem.c('rtcp-fb', { xmlns: 'urn:xmpp:jingle:apps:rtp:rtcp-fb:0',
493
-                type: tmp.type });
528
+            elem.c('rtcp-fb', {
529
+                xmlns: 'urn:xmpp:jingle:apps:rtp:rtcp-fb:0',
530
+                type: tmp.type
531
+            });
494 532
             if (tmp.params.length > 0) {
495 533
                 elem.attrs({ 'subtype': tmp.params[0] });
496 534
             }
@@ -501,7 +539,9 @@ SDP.prototype.rtcpFbToJingle = function(mediaindex, elem, payloadtype) { // XEP-
501 539
 
502 540
 SDP.prototype.rtcpFbFromJingle = function(elem, payloadtype) { // XEP-0293
503 541
     let media = '';
504
-    let tmp = elem.find('>rtcp-fb-trr-int[xmlns="urn:xmpp:jingle:apps:rtp:rtcp-fb:0"]');
542
+    let tmp
543
+        = elem.find(
544
+            '>rtcp-fb-trr-int[xmlns="urn:xmpp:jingle:apps:rtp:rtcp-fb:0"]');
505 545
 
506 546
     if (tmp.length) {
507 547
         media += 'a=rtcp-fb:* trr-int ';
@@ -533,7 +573,8 @@ SDP.prototype.fromJingle = function(jingle) {
533 573
         + 's=-\r\n'
534 574
         + 't=0 0\r\n';
535 575
 
536
-    // http://tools.ietf.org/html/draft-ietf-mmusic-sdp-bundle-negotiation-04#section-8
576
+    // http://tools.ietf.org/html/draft-ietf-mmusic-sdp-bundle-negotiation-04
577
+    // #section-8
537 578
     const groups
538 579
         = $(jingle).find('>group[xmlns="urn:xmpp:jingle:apps:grouping:0"]');
539 580
 
@@ -547,7 +588,10 @@ SDP.prototype.fromJingle = function(jingle) {
547 588
 
548 589
             if (contents.length > 0) {
549 590
                 self.raw
550
-                    += `a=group:${group.getAttribute('semantics') || group.getAttribute('type')} ${contents.join(' ')}\r\n`;
591
+                    += `a=group:${
592
+                        group.getAttribute('semantics')
593
+                            || group.getAttribute('type')} ${
594
+                        contents.join(' ')}\r\n`;
551 595
             }
552 596
         });
553 597
     }
@@ -617,7 +661,9 @@ SDP.prototype.jingle2media = function(content) {
617 661
     if (!sctp.length) {
618 662
         media += 'a=rtcp:1 IN IP4 0.0.0.0\r\n';
619 663
     }
620
-    tmp = content.find('>transport[xmlns="urn:xmpp:jingle:transports:ice-udp:1"]');
664
+    tmp
665
+        = content.find(
666
+            '>transport[xmlns="urn:xmpp:jingle:transports:ice-udp:1"]');
621 667
     if (tmp.length) {
622 668
         if (tmp.attr('ufrag')) {
623 669
             media += `${SDPUtil.build_iceufrag(tmp.attr('ufrag'))}\r\n`;
@@ -652,7 +698,8 @@ SDP.prototype.jingle2media = function(content) {
652 698
     media += `a=mid:${content.attr('name')}\r\n`;
653 699
 
654 700
     // <description><rtcp-mux/></description>
655
-    // see http://code.google.com/p/libjingle/issues/detail?id=309 -- no spec though
701
+    // see http://code.google.com/p/libjingle/issues/detail?id=309 -- no spec
702
+    // though
656 703
     // and http://mail.jabber.org/pipermail/jingle/2011-December/001761.html
657 704
     if (desc.find('rtcp-mux').length) {
658 705
         media += 'a=rtcp-mux\r\n';
@@ -694,44 +741,57 @@ SDP.prototype.jingle2media = function(content) {
694 741
     media += self.rtcpFbFromJingle(desc, '*');
695 742
 
696 743
     // xep-0294
697
-    tmp = desc.find('>rtp-hdrext[xmlns="urn:xmpp:jingle:apps:rtp:rtp-hdrext:0"]');
744
+    tmp
745
+        = desc.find(
746
+            '>rtp-hdrext[xmlns="urn:xmpp:jingle:apps:rtp:rtp-hdrext:0"]');
698 747
     tmp.each(function() {
699
-        media += `a=extmap:${this.getAttribute('id')} ${this.getAttribute('uri')}\r\n`;
748
+        media
749
+            += `a=extmap:${this.getAttribute('id')} ${
750
+                this.getAttribute('uri')}\r\n`;
700 751
     });
701 752
 
702
-    content.find('>transport[xmlns="urn:xmpp:jingle:transports:ice-udp:1"]>candidate').each(function() {
703
-        let protocol = this.getAttribute('protocol');
704
-
705
-        protocol = typeof protocol === 'string' ? protocol.toLowerCase() : '';
706
-
707
-        if ((self.removeTcpCandidates
708
-                && (protocol === 'tcp' || protocol === 'ssltcp'))
709
-            || (self.removeUdpCandidates && protocol === 'udp')) {
710
-            return;
711
-        } else if (self.failICE) {
712
-            this.setAttribute('ip', '1.1.1.1');
713
-        }
753
+    content
754
+        .find(
755
+            '>transport[xmlns="urn:xmpp:jingle:transports:ice-udp:1"]'
756
+                + '>candidate')
757
+        .each(function() {
758
+            let protocol = this.getAttribute('protocol');
759
+
760
+            protocol
761
+                = typeof protocol === 'string' ? protocol.toLowerCase() : '';
762
+
763
+            if ((self.removeTcpCandidates
764
+                    && (protocol === 'tcp' || protocol === 'ssltcp'))
765
+                || (self.removeUdpCandidates && protocol === 'udp')) {
766
+                return;
767
+            } else if (self.failICE) {
768
+                this.setAttribute('ip', '1.1.1.1');
769
+            }
714 770
 
715
-        media += SDPUtil.candidateFromJingle(this);
716
-    });
771
+            media += SDPUtil.candidateFromJingle(this);
772
+        });
717 773
 
718 774
     // XEP-0339 handle ssrc-group attributes
719
-    content.find('description>ssrc-group[xmlns="urn:xmpp:jingle:apps:rtp:ssma:0"]').each(function() {
720
-        const semantics = this.getAttribute('semantics');
721
-        const ssrcs
722
-            = $(this)
723
-                .find('>source')
724
-                .map(function() {
725
-                    return this.getAttribute('ssrc');
726
-                })
727
-                .get();
775
+    content
776
+        .find('description>ssrc-group[xmlns="urn:xmpp:jingle:apps:rtp:ssma:0"]')
777
+        .each(function() {
778
+            const semantics = this.getAttribute('semantics');
779
+            const ssrcs
780
+                = $(this)
781
+                    .find('>source')
782
+                    .map(function() {
783
+                        return this.getAttribute('ssrc');
784
+                    })
785
+                    .get();
728 786
 
729
-        if (ssrcs.length) {
730
-            media += `a=ssrc-group:${semantics} ${ssrcs.join(' ')}\r\n`;
731
-        }
732
-    });
787
+            if (ssrcs.length) {
788
+                media += `a=ssrc-group:${semantics} ${ssrcs.join(' ')}\r\n`;
789
+            }
790
+        });
733 791
 
734
-    tmp = content.find('description>source[xmlns="urn:xmpp:jingle:apps:rtp:ssma:0"]');
792
+    tmp
793
+        = content.find(
794
+            'description>source[xmlns="urn:xmpp:jingle:apps:rtp:ssma:0"]');
735 795
     tmp.each(function() {
736 796
         const ssrc = this.getAttribute('ssrc');
737 797
 

+ 41
- 14
modules/xmpp/SDPUtil.js View File

@@ -16,7 +16,11 @@ const SDPUtil = {
16 16
         let pwd, ufrag;
17 17
 
18 18
         if ((ufrag = SDPUtil.find_line(mediadesc, 'a=ice-ufrag:', sessiondesc))
19
-                && (pwd = SDPUtil.find_line(mediadesc, 'a=ice-pwd:', sessiondesc))) {
19
+                && (pwd
20
+                    = SDPUtil.find_line(
21
+                        mediadesc,
22
+                        'a=ice-pwd:',
23
+                        sessiondesc))) {
20 24
             data = {
21 25
                 ufrag: SDPUtil.parse_iceufrag(ufrag),
22 26
                 pwd: SDPUtil.parse_icepwd(pwd)
@@ -55,7 +59,9 @@ const SDPUtil = {
55 59
         return data;
56 60
     },
57 61
     build_mline(mline) {
58
-        return `m=${mline.media} ${mline.port} ${mline.proto} ${mline.fmt.join(' ')}`;
62
+        return (
63
+            `m=${mline.media} ${mline.port} ${mline.proto} ${
64
+                mline.fmt.join(' ')}`);
59 65
     },
60 66
     parse_rtpmap(line) {
61 67
         const data = {};
@@ -87,7 +93,9 @@ const SDPUtil = {
87 93
         return [ sctpPort, protocol, streamCount ];// SCTP port
88 94
     },
89 95
     build_rtpmap(el) {
90
-        let line = `a=rtpmap:${el.getAttribute('id')} ${el.getAttribute('name')}/${el.getAttribute('clockrate')}`;
96
+        let line
97
+            = `a=rtpmap:${el.getAttribute('id')} ${el.getAttribute('name')}/${
98
+                el.getAttribute('clockrate')}`;
91 99
 
92 100
         if (el.getAttribute('channels') && el.getAttribute('channels') != '1') {
93 101
             line += `/${el.getAttribute('channels')}`;
@@ -173,7 +181,9 @@ const SDPUtil = {
173 181
                 candidate.tcptype = elems[i + 1];
174 182
                 break;
175 183
             default: // TODO
176
-                logger.log(`parse_icecandidate not translating "${elems[i]}" = "${elems[i + 1]}"`);
184
+                logger.log(
185
+                    `parse_icecandidate not translating "${
186
+                        elems[i]}" = "${elems[i + 1]}"`);
177 187
             }
178 188
         }
179 189
         candidate.network = '1';
@@ -185,14 +195,24 @@ const SDPUtil = {
185 195
         return candidate;
186 196
     },
187 197
     build_icecandidate(cand) {
188
-        let line = [ `a=candidate:${cand.foundation}`, cand.component, cand.protocol, cand.priority, cand.ip, cand.port, 'typ', cand.type ].join(' ');
198
+        let line = [
199
+            `a=candidate:${cand.foundation}`,
200
+            cand.component,
201
+            cand.protocol,
202
+            cand.priority,
203
+            cand.ip,
204
+            cand.port,
205
+            'typ',
206
+            cand.type
207
+        ].join(' ');
189 208
 
190 209
         line += ' ';
191 210
         switch (cand.type) {
192 211
         case 'srflx':
193 212
         case 'prflx':
194 213
         case 'relay':
195
-            if (cand.hasOwnAttribute('rel-addr') && cand.hasOwnAttribute('rel-port')) {
214
+            if (cand.hasOwnAttribute('rel-addr')
215
+                    && cand.hasOwnAttribute('rel-port')) {
196 216
                 line += 'raddr';
197 217
                 line += ' ';
198 218
                 line += cand['rel-addr'];
@@ -218,8 +238,8 @@ const SDPUtil = {
218 238
     },
219 239
     parse_ssrc(desc) {
220 240
         // proprietary mapping of a=ssrc lines
221
-        // TODO: see "Jingle RTP Source Description" by Juberti and P. Thatcher on google docs
222
-        // and parse according to that
241
+        // TODO: see "Jingle RTP Source Description" by Juberti and P. Thatcher
242
+        // on google docs and parse according to that
223 243
         const data = {};
224 244
         const lines = desc.split('\r\n');
225 245
 
@@ -227,7 +247,8 @@ const SDPUtil = {
227 247
             if (lines[i].substring(0, 7) == 'a=ssrc:') {
228 248
                 const idx = lines[i].indexOf(' ');
229 249
 
230
-                data[lines[i].substr(idx + 1).split(':', 2)[0]] = lines[i].substr(idx + 1).split(':', 2)[1];
250
+                data[lines[i].substr(idx + 1).split(':', 2)[0]]
251
+                    = lines[i].substr(idx + 1).split(':', 2)[1];
231 252
             }
232 253
         }
233 254
 
@@ -305,12 +326,16 @@ const SDPUtil = {
305 326
         return needles;
306 327
     },
307 328
     candidateToJingle(line) {
308
-        // a=candidate:2979166662 1 udp 2113937151 192.168.2.100 57698 typ host generation 0
309
-        //      <candidate component=... foundation=... generation=... id=... ip=... network=... port=... priority=... protocol=... type=.../>
329
+        // a=candidate:2979166662 1 udp 2113937151 192.168.2.100 57698 typ host
330
+        // generation 0
331
+        //      <candidate component=... foundation=... generation=... id=...
332
+        // ip=... network=... port=... priority=... protocol=... type=.../>
310 333
         if (line.indexOf('candidate:') === 0) {
311 334
             line = `a=${line}`;
312 335
         } else if (line.substring(0, 12) != 'a=candidate:') {
313
-            logger.log('parseCandidate called with a line that is not a candidate line');
336
+            logger.log(
337
+                'parseCandidate called with a line that is not a candidate'
338
+                    + ' line');
314 339
             logger.log(line);
315 340
 
316 341
             return null;
@@ -395,7 +420,8 @@ const SDPUtil = {
395 420
         case 'srflx':
396 421
         case 'prflx':
397 422
         case 'relay':
398
-            if (cand.getAttribute('rel-addr') && cand.getAttribute('rel-port')) {
423
+            if (cand.getAttribute('rel-addr')
424
+                    && cand.getAttribute('rel-port')) {
399 425
                 line += 'raddr';
400 426
                 line += ' ';
401 427
                 line += cand.getAttribute('rel-addr');
@@ -540,7 +566,8 @@ const SDPUtil = {
540 566
             }
541 567
         }
542 568
         if (payloadType) {
543
-            const payloadTypes = videoMLine.payloads.split(' ').map(p => parseInt(p));
569
+            const payloadTypes
570
+                = videoMLine.payloads.split(' ').map(p => parseInt(p));
544 571
             const payloadIndex = payloadTypes.indexOf(payloadType);
545 572
 
546 573
             payloadTypes.splice(payloadIndex, 1);

+ 27
- 12
modules/xmpp/strophe.jingle.js View File

@@ -55,8 +55,12 @@ class JingleConnectionPlugin extends ConnectionPlugin {
55 55
                 ack.attrs({ type: 'error' });
56 56
                 ack.c('error', { type: 'cancel' })
57 57
                     .c('item-not-found', {
58
-                        xmlns: 'urn:ietf:params:xml:ns:xmpp-stanzas' }).up()
59
-                    .c('unknown-session', { xmlns: 'urn:xmpp:jingle:errors:1' });
58
+                        xmlns: 'urn:ietf:params:xml:ns:xmpp-stanzas'
59
+                    })
60
+                    .up()
61
+                    .c('unknown-session', {
62
+                        xmlns: 'urn:xmpp:jingle:errors:1'
63
+                    });
60 64
                 logger.warn('invalid session id', iq);
61 65
                 this.connection.send(ack);
62 66
 
@@ -69,18 +73,26 @@ class JingleConnectionPlugin extends ConnectionPlugin {
69 73
                     'jid mismatch for session id', sid, sess.peerjid, iq);
70 74
                 ack.attrs({ type: 'error' });
71 75
                 ack.c('error', { type: 'cancel' })
72
-                    .c('item-not-found', { xmlns: 'urn:ietf:params:xml:ns:xmpp-stanzas' }).up()
73
-                    .c('unknown-session', { xmlns: 'urn:xmpp:jingle:errors:1' });
76
+                    .c('item-not-found', {
77
+                        xmlns: 'urn:ietf:params:xml:ns:xmpp-stanzas'
78
+                    })
79
+                    .up()
80
+                    .c('unknown-session', {
81
+                        xmlns: 'urn:xmpp:jingle:errors:1'
82
+                    });
74 83
                 this.connection.send(ack);
75 84
 
76 85
                 return true;
77 86
             }
78 87
         } else if (sess !== undefined) {
79
-            // existing session with same session id
80
-            // this might be out-of-order if the sess.peerjid is the same as from
88
+            // Existing session with same session id. This might be out-of-order
89
+            // if the sess.peerjid is the same as from.
81 90
             ack.attrs({ type: 'error' });
82 91
             ack.c('error', { type: 'cancel' })
83
-                .c('service-unavailable', { xmlns: 'urn:ietf:params:xml:ns:xmpp-stanzas' }).up();
92
+                .c('service-unavailable', {
93
+                    xmlns: 'urn:ietf:params:xml:ns:xmpp-stanzas'
94
+                })
95
+                .up();
84 96
             logger.warn('duplicate session id', sid, iq);
85 97
             this.connection.send(ack);
86 98
 
@@ -188,11 +200,13 @@ class JingleConnectionPlugin extends ConnectionPlugin {
188 200
         // uses time-limited credentials as described in
189 201
         // http://tools.ietf.org/html/draft-uberti-behave-turn-rest-00
190 202
         //
191
-        // see https://code.google.com/p/prosody-modules/source/browse/mod_turncredentials/mod_turncredentials.lua
192
-        // for a prosody module which implements this
203
+        // See https://code.google.com/p/prosody-modules/source/browse/
204
+        // mod_turncredentials/mod_turncredentials.lua
205
+        // for a prosody module which implements this.
193 206
         //
194
-        // currently, this doesn't work with updateIce and therefore credentials with a long
195
-        // validity have to be fetched before creating the peerconnection
207
+        // Currently, this doesn't work with updateIce and therefore credentials
208
+        // with a long validity have to be fetched before creating the
209
+        // peerconnection.
196 210
         // TODO: implement refresh via updateIce as described in
197 211
         //      https://code.google.com/p/webrtc/issues/detail?id=1650
198 212
         this.connection.sendIQ(
@@ -221,7 +235,8 @@ class JingleConnectionPlugin extends ConnectionPlugin {
221 235
                         dict.url = `${type}:`;
222 236
                         const username = el.attr('username');
223 237
 
224
-                            // https://code.google.com/p/webrtc/issues/detail?id=1508
238
+                        // https://code.google.com/p/webrtc/issues/detail
239
+                        // ?id=1508
225 240
 
226 241
                         if (username) {
227 242
                             if (navigator.userAgent.match(

+ 24
- 22
modules/xmpp/xmpp.js View File

@@ -47,14 +47,15 @@ export default class XMPP extends Listenable {
47 47
 
48 48
         // Setup a disconnect on unload as a way to facilitate API consumers. It
49 49
         // sounds like they would want that. A problem for them though may be if
50
-        // they wanted to utilize the connected connection in an unload handler of
51
-        // their own. However, it should be fairly easy for them to do that by
52
-        // registering their unload handler before us.
50
+        // they wanted to utilize the connected connection in an unload handler
51
+        // of their own. However, it should be fairly easy for them to do that
52
+        // by registering their unload handler before us.
53 53
         $(window).on('beforeunload unload', this.disconnect.bind(this));
54 54
     }
55 55
 
56 56
     /**
57
-     * Initializes the list of feature advertised through the disco-info mechanism
57
+     * Initializes the list of feature advertised through the disco-info
58
+     * mechanism.
58 59
      */
59 60
     initFeaturesList() {
60 61
         // http://xmpp.org/extensions/xep-0167.html#support
@@ -237,9 +238,9 @@ export default class XMPP extends Listenable {
237 238
     }
238 239
 
239 240
     /**
240
-     * Attach to existing connection. Can be used for optimizations. For example:
241
-     * if the connection is created on the server we can attach to it and start
242
-     * using it.
241
+     * Attach to existing connection. Can be used for optimizations. For
242
+     * example: if the connection is created on the server we can attach to it
243
+     * and start using it.
243 244
      *
244 245
      * @param options {object} connecting options - rid, sid, jid and password.
245 246
      */
@@ -339,8 +340,8 @@ export default class XMPP extends Listenable {
339 340
     /**
340 341
      * Disconnects this from the XMPP server (if this is connected).
341 342
      *
342
-     * @param ev optionally, the event which triggered the necessity to disconnect
343
-     * from the XMPP server (e.g. beforeunload, unload)
343
+     * @param ev optionally, the event which triggered the necessity to
344
+     * disconnect from the XMPP server (e.g. beforeunload, unload).
344 345
      */
345 346
     disconnect(ev) {
346 347
         if (this.disconnectInProgress
@@ -354,16 +355,17 @@ export default class XMPP extends Listenable {
354 355
         this.disconnectInProgress = true;
355 356
 
356 357
         // XXX Strophe is asynchronously sending by default. Unfortunately, that
357
-        // means that there may not be enough time to send an unavailable presence
358
-        // or disconnect at all. Switching Strophe to synchronous sending is not
359
-        // much of an option because it may lead to a noticeable delay in navigating
360
-        // away from the current location. As a compromise, we will try to increase
361
-        // the chances of sending an unavailable presence and/or disconecting within
362
-        // the short time span that we have upon unloading by invoking flush() on
363
-        // the connection. We flush() once before disconnect() in order to attemtp
364
-        // to have its unavailable presence at the top of the send queue. We flush()
365
-        // once more after disconnect() in order to attempt to have its unavailable
366
-        // presence sent as soon as possible.
358
+        // means that there may not be enough time to send an unavailable
359
+        // presence or disconnect at all. Switching Strophe to synchronous
360
+        // sending is not much of an option because it may lead to a noticeable
361
+        // delay in navigating away from the current location. As a compromise,
362
+        // we will try to increase the chances of sending an unavailable
363
+        // presence and/or disconecting within the short time span that we have
364
+        // upon unloading by invoking flush() on the connection. We flush() once
365
+        // before disconnect() in order to attemtp to have its unavailable
366
+        // presence at the top of the send queue. We flush() once more after
367
+        // disconnect() in order to attempt to have its unavailable presence
368
+        // sent as soon as possible.
367 369
         this.connection.flush();
368 370
 
369 371
         if (ev !== null && typeof ev !== 'undefined') {
@@ -372,9 +374,9 @@ export default class XMPP extends Listenable {
372 374
             if (evType == 'beforeunload' || evType == 'unload') {
373 375
                 // XXX Whatever we said above, synchronous sending is the best
374 376
                 // (known) way to properly disconnect from the XMPP server.
375
-                // Consequently, it may be fine to have the source code and comment
376
-                // it in or out depending on whether we want to run with it for some
377
-                // time.
377
+                // Consequently, it may be fine to have the source code and
378
+                // comment it in or out depending on whether we want to run with
379
+                // it for some time.
378 380
                 this.connection.options.sync = true;
379 381
             }
380 382
         }

+ 2
- 2
service/RTC/CameraFacingMode.js View File

@@ -1,9 +1,9 @@
1
-/* global module */
2 1
 /**
3 2
  * The possible camera facing modes. For now support only 'user' and
4 3
  * 'environment' because 'left' and 'right' are not used anywhere in our
5 4
  * projects at the time of this writing. For more information please refer to
6
- * https://w3c.github.io/mediacapture-main/getusermedia.html#def-constraint-facingMode
5
+ * https://w3c.github.io/mediacapture-main/getusermedia.html
6
+ * #def-constraint-facingMode.
7 7
  *
8 8
  * @enum {string}
9 9
  */

Loading…
Cancel
Save