瀏覽代碼

Merge branch 'master' into eslint_improvements

dev1
hristoterezov 8 年之前
父節點
當前提交
9a86145f81

+ 5
- 0
.eslintrc.js 查看文件

82
         'brace-style': 2,
82
         'brace-style': 2,
83
         'indent': [ 'error', 4, { 'SwitchCase': 0 } ],
83
         'indent': [ 'error', 4, { 'SwitchCase': 0 } ],
84
 
84
 
85
+        'object-shorthand': [
86
+            'error',
87
+            'always',
88
+            { 'avoidQuotes': true }
89
+        ],
85
         'prefer-const': 2,
90
         'prefer-const': 2,
86
         'prefer-reflect': 0,
91
         'prefer-reflect': 0,
87
         'prefer-spread': 2,
92
         'prefer-spread': 2,

+ 1
- 1
JitsiConference.js 查看文件

1409
  * Sets a property for the local participant.
1409
  * Sets a property for the local participant.
1410
  */
1410
  */
1411
 JitsiConference.prototype.setLocalParticipantProperty = function(name, value) {
1411
 JitsiConference.prototype.setLocalParticipantProperty = function(name, value) {
1412
-    this.sendCommand("jitsi_participant_" + name, {value: value});
1412
+    this.sendCommand("jitsi_participant_" + name, {value});
1413
 };
1413
 };
1414
 
1414
 
1415
 /**
1415
 /**

+ 3
- 3
JitsiConferenceEventManager.js 查看文件

76
             for (key in chatRoom.connectionTimes){
76
             for (key in chatRoom.connectionTimes){
77
                 value = chatRoom.connectionTimes[key];
77
                 value = chatRoom.connectionTimes[key];
78
                 Statistics.analytics.sendEvent('conference.' + key,
78
                 Statistics.analytics.sendEvent('conference.' + key,
79
-                    {value: value});
79
+                    {value});
80
             }
80
             }
81
             for (key in chatRoom.xmpp.connectionTimes){
81
             for (key in chatRoom.xmpp.connectionTimes){
82
                 value = chatRoom.xmpp.connectionTimes[key];
82
                 value = chatRoom.xmpp.connectionTimes[key];
83
                 Statistics.analytics.sendEvent('xmpp.' + key,
83
                 Statistics.analytics.sendEvent('xmpp.' + key,
84
-                    {value: value});
84
+                    {value});
85
             }
85
             }
86
         });
86
         });
87
 
87
 
234
                 function (status, error) {
234
                 function (status, error) {
235
                     var logObject = {
235
                     var logObject = {
236
                         id: "recorder_status",
236
                         id: "recorder_status",
237
-                        status: status
237
+                        status
238
                     };
238
                     };
239
                     if (error) {
239
                     if (error) {
240
                         logObject.error = error;
240
                         logObject.error = error;

+ 2
- 2
JitsiConnection.js 查看文件

34
                     'connection.disconnected.' + msg);
34
                     'connection.disconnected.' + msg);
35
             }
35
             }
36
             Statistics.sendLog(
36
             Statistics.sendLog(
37
-                JSON.stringify({id: "connection.disconnected", msg: msg}));
37
+                JSON.stringify({id: "connection.disconnected", msg}));
38
         });
38
         });
39
 }
39
 }
40
 
40
 
92
  * @returns {JitsiConference} returns the new conference object.
92
  * @returns {JitsiConference} returns the new conference object.
93
  */
93
  */
94
 JitsiConnection.prototype.initJitsiConference = function (name, options) {
94
 JitsiConnection.prototype.initJitsiConference = function (name, options) {
95
-    return new JitsiConference({name: name, config: options, connection: this});
95
+    return new JitsiConference({name, config: options, connection: this});
96
 };
96
 };
97
 
97
 
98
 /**
98
 /**

+ 9
- 9
JitsiMediaDevices.js 查看文件

41
      * Executes callback with list of media devices connected.
41
      * Executes callback with list of media devices connected.
42
      * @param {function} callback
42
      * @param {function} callback
43
      */
43
      */
44
-    enumerateDevices: function (callback) {
44
+    enumerateDevices (callback) {
45
         RTC.enumerateDevices(callback);
45
         RTC.enumerateDevices(callback);
46
     },
46
     },
47
     /**
47
     /**
50
      * the WebRTC stack is ready, either with true if the device listing is
50
      * the WebRTC stack is ready, either with true if the device listing is
51
      * available available or with false otherwise.
51
      * available available or with false otherwise.
52
      */
52
      */
53
-    isDeviceListAvailable: function () {
53
+    isDeviceListAvailable () {
54
         return RTC.isDeviceListAvailable();
54
         return RTC.isDeviceListAvailable();
55
     },
55
     },
56
     /**
56
     /**
60
      *      undefined or 'input', 'output' - for audio output device change.
60
      *      undefined or 'input', 'output' - for audio output device change.
61
      * @returns {boolean} true if available, false otherwise.
61
      * @returns {boolean} true if available, false otherwise.
62
      */
62
      */
63
-    isDeviceChangeAvailable: function (deviceType) {
63
+    isDeviceChangeAvailable (deviceType) {
64
         return RTC.isDeviceChangeAvailable(deviceType);
64
         return RTC.isDeviceChangeAvailable(deviceType);
65
     },
65
     },
66
     /**
66
     /**
69
      *      undefined stands for both 'audio' and 'video' together
69
      *      undefined stands for both 'audio' and 'video' together
70
      * @returns {boolean}
70
      * @returns {boolean}
71
      */
71
      */
72
-    isDevicePermissionGranted: function (type) {
72
+    isDevicePermissionGranted (type) {
73
         var permissions = RTC.getDeviceAvailability();
73
         var permissions = RTC.getDeviceAvailability();
74
 
74
 
75
         switch(type) {
75
         switch(type) {
86
      * for default device
86
      * for default device
87
      * @returns {string}
87
      * @returns {string}
88
      */
88
      */
89
-    getAudioOutputDevice: function () {
89
+    getAudioOutputDevice () {
90
         return RTC.getAudioOutputDevice();
90
         return RTC.getAudioOutputDevice();
91
     },
91
     },
92
     /**
92
     /**
97
      * @returns {Promise} - resolves when audio output is changed, is rejected
97
      * @returns {Promise} - resolves when audio output is changed, is rejected
98
      *      otherwise
98
      *      otherwise
99
      */
99
      */
100
-    setAudioOutputDevice: function (deviceId) {
100
+    setAudioOutputDevice (deviceId) {
101
 
101
 
102
         var availableDevices = RTC.getCurrentlyAvailableMediaDevices();
102
         var availableDevices = RTC.getCurrentlyAvailableMediaDevices();
103
         if (availableDevices && availableDevices.length > 0) {
103
         if (availableDevices && availableDevices.length > 0) {
114
      * @param {string} event - event name
114
      * @param {string} event - event name
115
      * @param {function} handler - event handler
115
      * @param {function} handler - event handler
116
      */
116
      */
117
-    addEventListener: function (event, handler) {
117
+    addEventListener (event, handler) {
118
         eventEmitter.addListener(event, handler);
118
         eventEmitter.addListener(event, handler);
119
     },
119
     },
120
     /**
120
     /**
122
      * @param {string} event - event name
122
      * @param {string} event - event name
123
      * @param {function} handler - event handler
123
      * @param {function} handler - event handler
124
      */
124
      */
125
-    removeEventListener: function (event, handler) {
125
+    removeEventListener (event, handler) {
126
         eventEmitter.removeListener(event, handler);
126
         eventEmitter.removeListener(event, handler);
127
     },
127
     },
128
     /**
128
     /**
129
      * Emits an event.
129
      * Emits an event.
130
      * @param {string} event - event name
130
      * @param {string} event - event name
131
      */
131
      */
132
-    emitEvent: function (event) { // eslint-disable-line no-unused-vars
132
+    emitEvent (event) { // eslint-disable-line no-unused-vars
133
         eventEmitter.emit(...arguments);
133
         eventEmitter.emit(...arguments);
134
     }
134
     }
135
 };
135
 };

+ 17
- 17
JitsiMeetJS.js 查看文件

77
 
77
 
78
     version: '{#COMMIT_HASH#}',
78
     version: '{#COMMIT_HASH#}',
79
 
79
 
80
-    JitsiConnection: JitsiConnection,
80
+    JitsiConnection,
81
     events: {
81
     events: {
82
         conference: JitsiConferenceEvents,
82
         conference: JitsiConferenceEvents,
83
         connection: JitsiConnectionEvents,
83
         connection: JitsiConnectionEvents,
92
         track: JitsiTrackErrors
92
         track: JitsiTrackErrors
93
     },
93
     },
94
     errorTypes: {
94
     errorTypes: {
95
-        JitsiTrackError: JitsiTrackError
95
+        JitsiTrackError
96
     },
96
     },
97
     logLevels: Logger.levels,
97
     logLevels: Logger.levels,
98
     mediaDevices: JitsiMediaDevices,
98
     mediaDevices: JitsiMediaDevices,
99
     analytics: null,
99
     analytics: null,
100
-    init: function (options) {
100
+    init (options) {
101
         let logObject, attr;
101
         let logObject, attr;
102
         Statistics.init(options);
102
         Statistics.init(options);
103
 
103
 
140
      * Returns whether the desktop sharing is enabled or not.
140
      * Returns whether the desktop sharing is enabled or not.
141
      * @returns {boolean}
141
      * @returns {boolean}
142
      */
142
      */
143
-    isDesktopSharingEnabled: function () {
143
+    isDesktopSharingEnabled () {
144
         return RTC.isDesktopSharingEnabled();
144
         return RTC.isDesktopSharingEnabled();
145
     },
145
     },
146
-    setLogLevel: function (level) {
146
+    setLogLevel (level) {
147
         Logger.setLogLevel(level);
147
         Logger.setLogLevel(level);
148
     },
148
     },
149
     /**
149
     /**
153
      * Usually it's the name of the JavaScript source file including the path
153
      * Usually it's the name of the JavaScript source file including the path
154
      * ex. "modules/xmpp/ChatRoom.js"
154
      * ex. "modules/xmpp/ChatRoom.js"
155
      */
155
      */
156
-    setLogLevelById: function (level, id) {
156
+    setLogLevelById (level, id) {
157
         Logger.setLogLevelById(level, id);
157
         Logger.setLogLevelById(level, id);
158
     },
158
     },
159
     /**
159
     /**
161
      * @param globalTransport
161
      * @param globalTransport
162
      * @see Logger.addGlobalTransport
162
      * @see Logger.addGlobalTransport
163
      */
163
      */
164
-    addGlobalLogTransport: function (globalTransport) {
164
+    addGlobalLogTransport (globalTransport) {
165
         Logger.addGlobalTransport(globalTransport);
165
         Logger.addGlobalTransport(globalTransport);
166
     },
166
     },
167
     /**
167
     /**
169
      * @param globalTransport
169
      * @param globalTransport
170
      * @see Logger.removeGlobalTransport
170
      * @see Logger.removeGlobalTransport
171
      */
171
      */
172
-    removeGlobalLogTransport: function (globalTransport) {
172
+    removeGlobalLogTransport (globalTransport) {
173
         Logger.removeGlobalTransport(globalTransport);
173
         Logger.removeGlobalTransport(globalTransport);
174
     },
174
     },
175
     /**
175
     /**
211
      *     A promise that returns an array of created JitsiTracks if resolved,
211
      *     A promise that returns an array of created JitsiTracks if resolved,
212
      *     or a JitsiConferenceError if rejected.
212
      *     or a JitsiConferenceError if rejected.
213
      */
213
      */
214
-    createLocalTracks: function (options, firePermissionPromptIsShownEvent) {
214
+    createLocalTracks (options, firePermissionPromptIsShownEvent) {
215
         var promiseFulfilled = false;
215
         var promiseFulfilled = false;
216
 
216
 
217
         if (firePermissionPromptIsShownEvent === true) {
217
         if (firePermissionPromptIsShownEvent === true) {
332
      * available available or with false otherwise.
332
      * available available or with false otherwise.
333
      * @deprecated use JitsiMeetJS.mediaDevices.isDeviceListAvailable instead
333
      * @deprecated use JitsiMeetJS.mediaDevices.isDeviceListAvailable instead
334
      */
334
      */
335
-    isDeviceListAvailable: function () {
335
+    isDeviceListAvailable () {
336
         logger.warn('This method is deprecated, use ' +
336
         logger.warn('This method is deprecated, use ' +
337
             'JitsiMeetJS.mediaDevices.isDeviceListAvailable instead');
337
             'JitsiMeetJS.mediaDevices.isDeviceListAvailable instead');
338
         return this.mediaDevices.isDeviceListAvailable();
338
         return this.mediaDevices.isDeviceListAvailable();
345
      * @returns {boolean} true if available, false otherwise.
345
      * @returns {boolean} true if available, false otherwise.
346
      * @deprecated use JitsiMeetJS.mediaDevices.isDeviceChangeAvailable instead
346
      * @deprecated use JitsiMeetJS.mediaDevices.isDeviceChangeAvailable instead
347
      */
347
      */
348
-    isDeviceChangeAvailable: function (deviceType) {
348
+    isDeviceChangeAvailable (deviceType) {
349
         logger.warn('This method is deprecated, use ' +
349
         logger.warn('This method is deprecated, use ' +
350
             'JitsiMeetJS.mediaDevices.isDeviceChangeAvailable instead');
350
             'JitsiMeetJS.mediaDevices.isDeviceChangeAvailable instead');
351
         return this.mediaDevices.isDeviceChangeAvailable(deviceType);
351
         return this.mediaDevices.isDeviceChangeAvailable(deviceType);
355
      * @param {function} callback
355
      * @param {function} callback
356
      * @deprecated use JitsiMeetJS.mediaDevices.enumerateDevices instead
356
      * @deprecated use JitsiMeetJS.mediaDevices.enumerateDevices instead
357
      */
357
      */
358
-    enumerateDevices: function (callback) {
358
+    enumerateDevices (callback) {
359
         logger.warn('This method is deprecated, use ' +
359
         logger.warn('This method is deprecated, use ' +
360
             'JitsiMeetJS.mediaDevices.enumerateDevices instead');
360
             'JitsiMeetJS.mediaDevices.enumerateDevices instead');
361
         this.mediaDevices.enumerateDevices(callback);
361
         this.mediaDevices.enumerateDevices(callback);
366
      * the function used by the lib.
366
      * the function used by the lib.
367
      * (function(message, source, lineno, colno, error)).
367
      * (function(message, source, lineno, colno, error)).
368
      */
368
      */
369
-    getGlobalOnErrorHandler: function (message, source, lineno, colno, error) {
369
+    getGlobalOnErrorHandler (message, source, lineno, colno, error) {
370
         logger.error(
370
         logger.error(
371
             'UnhandledError: ' + message,
371
             'UnhandledError: ' + message,
372
             'Script: ' + source,
372
             'Script: ' + source,
380
      * Returns current machine id saved from the local storage.
380
      * Returns current machine id saved from the local storage.
381
      * @returns {string} the machine id
381
      * @returns {string} the machine id
382
      */
382
      */
383
-    getMachineId: function() {
383
+    getMachineId() {
384
         return Settings.getMachineId();
384
         return Settings.getMachineId();
385
     },
385
     },
386
 
386
 
389
      * interest to LibJitsiMeet clients.
389
      * interest to LibJitsiMeet clients.
390
      */
390
      */
391
     util: {
391
     util: {
392
-        ScriptUtil: ScriptUtil,
393
-        RTCUIHelper: RTCUIHelper,
394
-        AuthUtil: AuthUtil
392
+        ScriptUtil,
393
+        RTCUIHelper,
394
+        AuthUtil
395
     }
395
     }
396
 };
396
 };
397
 
397
 

+ 1
- 1
modules/RTC/DataChannels.js 查看文件

275
 DataChannels.prototype.sendDataChannelMessage = function (to, payload) {
275
 DataChannels.prototype.sendDataChannelMessage = function (to, payload) {
276
     this.send({
276
     this.send({
277
         colibriClass: "EndpointMessage",
277
         colibriClass: "EndpointMessage",
278
-        to: to,
278
+        to,
279
         msgPayload: payload
279
         msgPayload: payload
280
     });
280
     });
281
 };
281
 };

+ 4
- 4
modules/RTC/RTCUIHelper.js 查看文件

10
      * currently using.
10
      * currently using.
11
      * @returns {string} 'video' or 'object' string name of WebRTC video element
11
      * @returns {string} 'video' or 'object' string name of WebRTC video element
12
      */
12
      */
13
-    getVideoElementName: function () {
13
+    getVideoElementName () {
14
         return RTCBrowserType.isTemasysPluginUsed() ? 'object' : 'video';
14
         return RTCBrowserType.isTemasysPluginUsed() ? 'object' : 'video';
15
     },
15
     },
16
 
16
 
21
      * @returns {HTMLElement} video HTML element instance if found inside of the
21
      * @returns {HTMLElement} video HTML element instance if found inside of the
22
      *          container or undefined otherwise.
22
      *          container or undefined otherwise.
23
      */
23
      */
24
-    findVideoElement: function (containerElement) {
24
+    findVideoElement (containerElement) {
25
         var videoElemName = RTCUIHelper.getVideoElementName();
25
         var videoElemName = RTCUIHelper.getVideoElementName();
26
         if (!RTCBrowserType.isTemasysPluginUsed()) {
26
         if (!RTCBrowserType.isTemasysPluginUsed()) {
27
             return $(containerElement).find(videoElemName)[0];
27
             return $(containerElement).find(videoElemName)[0];
45
      * @param streamElement HTML element to which the RTC stream is attached to.
45
      * @param streamElement HTML element to which the RTC stream is attached to.
46
      * @param volume the volume value to be set.
46
      * @param volume the volume value to be set.
47
      */
47
      */
48
-    setVolume: function (streamElement, volume) {
48
+    setVolume (streamElement, volume) {
49
         if (!RTCBrowserType.isIExplorer()) {
49
         if (!RTCBrowserType.isIExplorer()) {
50
             streamElement.volume = volume;
50
             streamElement.volume = volume;
51
         }
51
         }
56
      * @param streamElement HTML element to which the RTC stream is attached to.
56
      * @param streamElement HTML element to which the RTC stream is attached to.
57
      * @param autoPlay 'true' or 'false'
57
      * @param autoPlay 'true' or 'false'
58
      */
58
      */
59
-    setAutoPlay: function (streamElement, autoPlay) {
59
+    setAutoPlay (streamElement, autoPlay) {
60
         if (!RTCBrowserType.isIExplorer()) {
60
         if (!RTCBrowserType.isIExplorer()) {
61
             streamElement.autoplay = autoPlay;
61
             streamElement.autoplay = autoPlay;
62
         }
62
         }

+ 5
- 5
modules/RTC/RTCUtils.js 查看文件

178
                 constraints.video.facingMode = facingMode;
178
                 constraints.video.facingMode = facingMode;
179
             }
179
             }
180
             constraints.video.optional.push({
180
             constraints.video.optional.push({
181
-                facingMode: facingMode
181
+                facingMode
182
             });
182
             });
183
         }
183
         }
184
 
184
 
639
             track: videoStream.getVideoTracks()[0],
639
             track: videoStream.getVideoTracks()[0],
640
             mediaType: MediaType.VIDEO,
640
             mediaType: MediaType.VIDEO,
641
             videoType: VideoType.CAMERA,
641
             videoType: VideoType.CAMERA,
642
-            resolution: resolution
642
+            resolution
643
         });
643
         });
644
     }
644
     }
645
 
645
 
1034
                 obtainDevices({
1034
                 obtainDevices({
1035
                     devices: options.devices,
1035
                     devices: options.devices,
1036
                     streams: [],
1036
                     streams: [],
1037
-                    successCallback: successCallback,
1037
+                    successCallback,
1038
                     errorCallback: reject,
1038
                     errorCallback: reject,
1039
-                    deviceGUM: deviceGUM
1039
+                    deviceGUM
1040
                 });
1040
                 });
1041
             } else {
1041
             } else {
1042
                 var hasDesktop = options.devices.indexOf('desktop') > -1;
1042
                 var hasDesktop = options.devices.indexOf('desktop') > -1;
1108
                                     dsOptions,
1108
                                     dsOptions,
1109
                                     function (desktopStream) {
1109
                                     function (desktopStream) {
1110
                                         successCallback({audioVideo: stream,
1110
                                         successCallback({audioVideo: stream,
1111
-                                            desktopStream: desktopStream});
1111
+                                            desktopStream});
1112
                                     }, function (error) {
1112
                                     }, function (error) {
1113
                                         self.stopMediaStream(stream);
1113
                                         self.stopMediaStream(stream);
1114
 
1114
 

+ 4
- 4
modules/RTC/TraceablePeerConnection.js 查看文件

563
 };
563
 };
564
 
564
 
565
 var getters = {
565
 var getters = {
566
-    signalingState: function () {
566
+    signalingState () {
567
         return this.peerconnection.signalingState;
567
         return this.peerconnection.signalingState;
568
     },
568
     },
569
-    iceConnectionState: function () {
569
+    iceConnectionState () {
570
         return this.peerconnection.iceConnectionState;
570
         return this.peerconnection.iceConnectionState;
571
     },
571
     },
572
-    localDescription:  function() {
572
+    localDescription() {
573
         var desc = this.peerconnection.localDescription;
573
         var desc = this.peerconnection.localDescription;
574
 
574
 
575
         this.trace('getLocalDescription::preTransform', dumpSDP(desc));
575
         this.trace('getLocalDescription::preTransform', dumpSDP(desc));
582
         }
582
         }
583
         return desc;
583
         return desc;
584
     },
584
     },
585
-    remoteDescription:  function() {
585
+    remoteDescription() {
586
         var desc = this.peerconnection.remoteDescription;
586
         var desc = this.peerconnection.remoteDescription;
587
         this.trace('getRemoteDescription::preTransform', dumpSDP(desc));
587
         this.trace('getRemoteDescription::preTransform', dumpSDP(desc));
588
 
588
 

+ 2
- 2
modules/statistics/AnalyticsAdapter.js 查看文件

24
      */
24
      */
25
     sendEvent(action, data = {}) {
25
     sendEvent(action, data = {}) {
26
         this.eventCache.push({
26
         this.eventCache.push({
27
-            action: action,
28
-            data: data
27
+            action,
28
+            data
29
         });
29
         });
30
     }
30
     }
31
 
31
 

+ 2
- 2
modules/statistics/CallStats.js 查看文件

357
     } else {
357
     } else {
358
         CallStats.reportsQueue.push({
358
         CallStats.reportsQueue.push({
359
             type: reportType.EVENT,
359
             type: reportType.EVENT,
360
-            data: {event: event, eventData: eventData}
360
+            data: {event, eventData}
361
         });
361
         });
362
         CallStats._checkInitialize();
362
         CallStats._checkInitialize();
363
     }
363
     }
422
     } else {
422
     } else {
423
         CallStats.reportsQueue.push({
423
         CallStats.reportsQueue.push({
424
             type: reportType.ERROR,
424
             type: reportType.ERROR,
425
-            data: { type: type, error: e, pc: pc}
425
+            data: { type, error: e, pc}
426
         });
426
         });
427
         CallStats._checkInitialize();
427
         CallStats._checkInitialize();
428
     }
428
     }

+ 2
- 2
modules/statistics/RTPStatsCollector.js 查看文件

427
                 );
427
                 );
428
             })) {
428
             })) {
429
                 conferenceStatsTransport.push(
429
                 conferenceStatsTransport.push(
430
-                    {ip: ip, type: type, localip: localip});
430
+                    {ip, type, localip});
431
             }
431
             }
432
             continue;
432
             continue;
433
         }
433
         }
487
         ssrcStats.setLoss({
487
         ssrcStats.setLoss({
488
             packetsTotal: packetsDiff + packetsLostDiff,
488
             packetsTotal: packetsDiff + packetsLostDiff,
489
             packetsLost: packetsLostDiff,
489
             packetsLost: packetsLostDiff,
490
-            isDownloadStream: isDownloadStream
490
+            isDownloadStream
491
         });
491
         });
492
 
492
 
493
         var bytesReceivedNow = getNonNegativeStat(now, 'bytesReceived');
493
         var bytesReceivedNow = getNonNegativeStat(now, 'bytesReceived');

+ 1
- 1
modules/statistics/statistics.js 查看文件

439
         this.callstats.sendFeedback(overall, detailed);
439
         this.callstats.sendFeedback(overall, detailed);
440
     }
440
     }
441
     Statistics.analytics.sendEvent("feedback.rating",
441
     Statistics.analytics.sendEvent("feedback.rating",
442
-        {value: overall, detailed: detailed});
442
+        {value: overall, detailed});
443
 };
443
 };
444
 
444
 
445
 Statistics.LOCAL_JID = require("../../service/statistics/constants").LOCAL_JID;
445
 Statistics.LOCAL_JID = require("../../service/statistics/constants").LOCAL_JID;

+ 1
- 1
modules/transcription/transcriberHolder.js 查看文件

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

+ 1
- 1
modules/util/AuthUtil.js 查看文件

20
      * <tt>null</tt> if 'urlPattern' is not a string and the URL can not be
20
      * <tt>null</tt> if 'urlPattern' is not a string and the URL can not be
21
      * constructed.
21
      * constructed.
22
      */
22
      */
23
-    getTokenAuthUrl: function (urlPattern, roomName, roleUpgrade) {
23
+    getTokenAuthUrl (urlPattern, roomName, roleUpgrade) {
24
         var url = urlPattern;
24
         var url = urlPattern;
25
         if (typeof url !== "string") {
25
         if (typeof url !== "string") {
26
             return null;
26
             return null;

+ 3
- 3
modules/util/GlobalOnErrorHandler.js 查看文件

53
      * Adds new error handlers.
53
      * Adds new error handlers.
54
      * @param handler the new handler.
54
      * @param handler the new handler.
55
      */
55
      */
56
-    addHandler: function (handler) {
56
+    addHandler (handler) {
57
         handlers.push(handler);
57
         handlers.push(handler);
58
     },
58
     },
59
     /**
59
     /**
60
      * Calls the global error handler if there is one.
60
      * Calls the global error handler if there is one.
61
      * @param error the error to pass to the error handler
61
      * @param error the error to pass to the error handler
62
      */
62
      */
63
-    callErrorHandler: function (error) {
63
+    callErrorHandler (error) {
64
         var errHandler = window.onerror;
64
         var errHandler = window.onerror;
65
         if(!errHandler) {
65
         if(!errHandler) {
66
             return;
66
             return;
71
      * Calls the global rejection handler if there is one.
71
      * Calls the global rejection handler if there is one.
72
      * @param error the error to pass to the rejection handler.
72
      * @param error the error to pass to the rejection handler.
73
      */
73
      */
74
-    callUnhandledRejectionHandler: function (error) {
74
+    callUnhandledRejectionHandler (error) {
75
         var errHandler = window.onunhandledrejection;
75
         var errHandler = window.onunhandledrejection;
76
         if(!errHandler) {
76
         if(!errHandler) {
77
             return;
77
             return;

+ 5
- 5
modules/util/RandomUtil.js 查看文件

52
      * Returns a random hex digit.
52
      * Returns a random hex digit.
53
      * @returns {*}
53
      * @returns {*}
54
      */
54
      */
55
-    randomHexDigit: function() {
55
+    randomHexDigit() {
56
         return randomElement(HEX_DIGITS);
56
         return randomElement(HEX_DIGITS);
57
     },
57
     },
58
     /**
58
     /**
59
      * Returns a random string of hex digits with length 'len'.
59
      * Returns a random string of hex digits with length 'len'.
60
      * @param len the length.
60
      * @param len the length.
61
      */
61
      */
62
-    randomHexString: function (len) {
62
+    randomHexString (len) {
63
         var ret = '';
63
         var ret = '';
64
         while (len--) {
64
         while (len--) {
65
             ret += this.randomHexDigit();
65
             ret += this.randomHexDigit();
66
         }
66
         }
67
         return ret;
67
         return ret;
68
     },
68
     },
69
-    randomElement: randomElement,
70
-    randomAlphanumStr: randomAlphanumStr,
71
-    randomInt: randomInt
69
+    randomElement,
70
+    randomAlphanumStr,
71
+    randomInt
72
 };
72
 };
73
 
73
 
74
 module.exports = RandomUtil;
74
 module.exports = RandomUtil;

+ 1
- 1
modules/util/ScriptUtil.js 查看文件

21
      * @param loadCallback on load callback function
21
      * @param loadCallback on load callback function
22
      * @param errorCallback callback to be called on error loading the script
22
      * @param errorCallback callback to be called on error loading the script
23
      */
23
      */
24
-    loadScript: function (src, async, prepend, relativeURL,
24
+    loadScript (src, async, prepend, relativeURL,
25
                           loadCallback, errorCallback) {
25
                           loadCallback, errorCallback) {
26
         var d = document;
26
         var d = document;
27
         var tagName = 'script';
27
         var tagName = 'script';

+ 1
- 1
modules/util/UsernameGenerator.js 查看文件

437
 }
437
 }
438
 
438
 
439
 module.exports = {
439
 module.exports = {
440
-    generateUsername: generateUsername
440
+    generateUsername
441
 };
441
 };

+ 1
- 1
modules/version/ComponentsVersions.js 查看文件

69
                 log.push({
69
                 log.push({
70
                     id: "component_version",
70
                     id: "component_version",
71
                     component: componentName,
71
                     component: componentName,
72
-                    version: version});
72
+                    version});
73
             }
73
             }
74
         }.bind(this));
74
         }.bind(this));
75
 
75
 

+ 5
- 5
modules/xmpp/ChatRoom.js 查看文件

10
 const logger = getLogger(__filename);
10
 const logger = getLogger(__filename);
11
 
11
 
12
 var parser = {
12
 var parser = {
13
-    packet2JSON: function (packet, nodes) {
13
+    packet2JSON (packet, nodes) {
14
         var self = this;
14
         var self = this;
15
         $(packet).children().each(function () {
15
         $(packet).children().each(function () {
16
             var tagName = $(this).prop("tagName");
16
             var tagName = $(this).prop("tagName");
17
             const node = {
17
             const node = {
18
-                tagName: tagName
18
+                tagName
19
             };
19
             };
20
             node.attributes = {};
20
             node.attributes = {};
21
             $($(this)[0].attributes).each(function( index, attr ) {
21
             $($(this)[0].attributes).each(function( index, attr ) {
30
             self.packet2JSON($(this), node.children);
30
             self.packet2JSON($(this), node.children);
31
         });
31
         });
32
     },
32
     },
33
-    json2packet: function (nodes, packet) {
33
+    json2packet (nodes, packet) {
34
         for(let i = 0; i < nodes.length; i++) {
34
         for(let i = 0; i < nodes.length; i++) {
35
             const node = nodes[i];
35
             const node = nodes[i];
36
             if(!node || node === null){
36
             if(!node || node === null){
139
             return;
139
             return;
140
         }
140
         }
141
 
141
 
142
-        var pres = $pres({to: to });
142
+        var pres = $pres({to });
143
 
143
 
144
         // xep-0045 defines: "including in the initial presence stanza an empty
144
         // xep-0045 defines: "including in the initial presence stanza an empty
145
         // <x/> element qualified by the 'http://jabber.org/protocol/muc' namespace"
145
         // <x/> element qualified by the 'http://jabber.org/protocol/muc' namespace"
877
             {to: this.focusMucJid, type: 'set'})
877
             {to: this.focusMucJid, type: 'set'})
878
             .c('mute', {
878
             .c('mute', {
879
                 xmlns: 'http://jitsi.org/jitmeet/audio',
879
                 xmlns: 'http://jitsi.org/jitmeet/audio',
880
-                jid: jid
880
+                jid
881
             })
881
             })
882
             .t(mute.toString())
882
             .t(mute.toString())
883
             .up();
883
             .up();

+ 2
- 2
modules/xmpp/RtxModifier.js 查看文件

162
                 videoMLine,
162
                 videoMLine,
163
                 {
163
                 {
164
                     id: ssrc,
164
                     id: ssrc,
165
-                    cname: cname,
166
-                    msid: msid
165
+                    cname,
166
+                    msid
167
                 },
167
                 },
168
                 correspondingRtxSsrc);
168
                 correspondingRtxSsrc);
169
         }
169
         }

+ 11
- 11
modules/xmpp/SDP.js 查看文件

50
         tmp = SDPUtil.find_lines(self.media[mediaindex], 'a=ssrc:');
50
         tmp = SDPUtil.find_lines(self.media[mediaindex], 'a=ssrc:');
51
         var mid = SDPUtil.parse_mid(SDPUtil.find_line(self.media[mediaindex], 'a=mid:'));
51
         var mid = SDPUtil.parse_mid(SDPUtil.find_line(self.media[mediaindex], 'a=mid:'));
52
         var media = {
52
         var media = {
53
-            mediaindex: mediaindex,
54
-            mid: mid,
53
+            mediaindex,
54
+            mid,
55
             ssrcs: {},
55
             ssrcs: {},
56
             ssrcGroups: []
56
             ssrcGroups: []
57
         };
57
         };
74
             var ssrcs = line.substr(14 + semantics.length).split(' ');
74
             var ssrcs = line.substr(14 + semantics.length).split(' ');
75
             if (ssrcs.length) {
75
             if (ssrcs.length) {
76
                 media.ssrcGroups.push({
76
                 media.ssrcGroups.push({
77
-                    semantics: semantics,
78
-                    ssrcs: ssrcs
77
+                    semantics,
78
+                    ssrcs
79
                 });
79
                 });
80
             }
80
             }
81
         });
81
         });
160
         for (i = 0; i < lines.length; i++) {
160
         for (i = 0; i < lines.length; i++) {
161
             tmp = lines[i].split(' ');
161
             tmp = lines[i].split(' ');
162
             var semantics = tmp.shift().substr(8);
162
             var semantics = tmp.shift().substr(8);
163
-            elem.c('group', {xmlns: 'urn:xmpp:jingle:apps:grouping:0', semantics:semantics});
163
+            elem.c('group', {xmlns: 'urn:xmpp:jingle:apps:grouping:0', semantics});
164
             for (j = 0; j < tmp.length; j++) {
164
             for (j = 0; j < tmp.length; j++) {
165
                 elem.c('content', {name: tmp[j]}).up();
165
                 elem.c('content', {name: tmp[j]}).up();
166
             }
166
             }
194
                 {xmlns: 'urn:xmpp:jingle:apps:rtp:1',
194
                 {xmlns: 'urn:xmpp:jingle:apps:rtp:1',
195
                     media: mline.media });
195
                     media: mline.media });
196
             if (ssrc) {
196
             if (ssrc) {
197
-                elem.attrs({ssrc: ssrc});
197
+                elem.attrs({ssrc});
198
             }
198
             }
199
             for (j = 0; j < mline.fmt.length; j++) {
199
             for (j = 0; j < mline.fmt.length; j++) {
200
                 rtpmap = SDPUtil.find_line(this.media[i], 'a=rtpmap:' + mline.fmt[j]);
200
                 rtpmap = SDPUtil.find_line(this.media[i], 'a=rtpmap:' + mline.fmt[j]);
222
 
222
 
223
             if (ssrc) {
223
             if (ssrc) {
224
                 // new style mapping
224
                 // new style mapping
225
-                elem.c('source', { ssrc: ssrc, xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0' });
225
+                elem.c('source', { ssrc, xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0' });
226
                 // FIXME: group by ssrc and support multiple different ssrcs
226
                 // FIXME: group by ssrc and support multiple different ssrcs
227
                 var ssrclines = SDPUtil.find_lines(this.media[i], 'a=ssrc:');
227
                 var ssrclines = SDPUtil.find_lines(this.media[i], 'a=ssrc:');
228
                 if(ssrclines.length > 0) {
228
                 if(ssrclines.length > 0) {
232
                         if (linessrc != ssrc) {
232
                         if (linessrc != ssrc) {
233
                             elem.up();
233
                             elem.up();
234
                             ssrc = linessrc;
234
                             ssrc = linessrc;
235
-                            elem.c('source', { ssrc: ssrc, xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0' });
235
+                            elem.c('source', { ssrc, xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0' });
236
                         }
236
                         }
237
                         var kv = line.substr(idx + 1);
237
                         var kv = line.substr(idx + 1);
238
                         elem.c('parameter');
238
                         elem.c('parameter');
250
                     });
250
                     });
251
                 } else {
251
                 } else {
252
                     elem.up();
252
                     elem.up();
253
-                    elem.c('source', { ssrc: ssrc, xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0' });
253
+                    elem.c('source', { ssrc, xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0' });
254
                     elem.c('parameter');
254
                     elem.c('parameter');
255
                     elem.attrs({name: "cname", value:Math.random().toString(36).substring(7)});
255
                     elem.attrs({name: "cname", value:Math.random().toString(36).substring(7)});
256
                     elem.up();
256
                     elem.up();
285
                     var semantics = line.substr(0, idx).substr(13);
285
                     var semantics = line.substr(0, idx).substr(13);
286
                     var ssrcs = line.substr(14 + semantics.length).split(' ');
286
                     var ssrcs = line.substr(14 + semantics.length).split(' ');
287
                     if (ssrcs.length) {
287
                     if (ssrcs.length) {
288
-                        elem.c('ssrc-group', { semantics: semantics, xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0' });
288
+                        elem.c('ssrc-group', { semantics, xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0' });
289
                         ssrcs.forEach(function(ssrc) {
289
                         ssrcs.forEach(function(ssrc) {
290
-                            elem.c('source', { ssrc: ssrc })
290
+                            elem.c('source', { ssrc })
291
                                 .up();
291
                                 .up();
292
                         });
292
                         });
293
                         elem.up();
293
                         elem.up();

+ 3
- 3
modules/xmpp/SDPDiffer.js 查看文件

134
                     var nv = kv.split(':', 2);
134
                     var nv = kv.split(':', 2);
135
                     var name = nv[0];
135
                     var name = nv[0];
136
                     var value = SDPUtil.filter_special_chars(nv[1]);
136
                     var value = SDPUtil.filter_special_chars(nv[1]);
137
-                    modify.attrs({ name: name });
138
-                    modify.attrs({ value: value });
137
+                    modify.attrs({ name });
138
+                    modify.attrs({ value });
139
                 }
139
                 }
140
                 modify.up(); // end of parameter
140
                 modify.up(); // end of parameter
141
             });
141
             });
152
                 });
152
                 });
153
 
153
 
154
                 ssrcGroup.ssrcs.forEach(function (ssrc) {
154
                 ssrcGroup.ssrcs.forEach(function (ssrc) {
155
-                    modify.c('source', { ssrc: ssrc })
155
+                    modify.c('source', { ssrc })
156
                         .up(); // end of source
156
                         .up(); // end of source
157
                 });
157
                 });
158
                 modify.up(); // end of ssrc-group
158
                 modify.up(); // end of ssrc-group

+ 31
- 31
modules/xmpp/SDPUtil.js 查看文件

4
 var RTCBrowserType = require("../RTC/RTCBrowserType");
4
 var RTCBrowserType = require("../RTC/RTCBrowserType");
5
 
5
 
6
 var SDPUtil = {
6
 var SDPUtil = {
7
-    filter_special_chars: function (text) {
7
+    filter_special_chars (text) {
8
         // XXX Neither one of the falsy values (e.g. null, undefined, false,
8
         // XXX Neither one of the falsy values (e.g. null, undefined, false,
9
         // "", etc.) "contain" special chars.
9
         // "", etc.) "contain" special chars.
10
         return text ? text.replace(/[\\\/\{,\}\+]/g, "") : text;
10
         return text ? text.replace(/[\\\/\{,\}\+]/g, "") : text;
11
     },
11
     },
12
-    iceparams: function (mediadesc, sessiondesc) {
12
+    iceparams (mediadesc, sessiondesc) {
13
         var data = null;
13
         var data = null;
14
         var ufrag, pwd;
14
         var ufrag, pwd;
15
         if ((ufrag = SDPUtil.find_line(mediadesc, 'a=ice-ufrag:', sessiondesc))
15
         if ((ufrag = SDPUtil.find_line(mediadesc, 'a=ice-ufrag:', sessiondesc))
21
         }
21
         }
22
         return data;
22
         return data;
23
     },
23
     },
24
-    parse_iceufrag: function (line) {
24
+    parse_iceufrag (line) {
25
         return line.substring(12);
25
         return line.substring(12);
26
     },
26
     },
27
-    build_iceufrag: function (frag) {
27
+    build_iceufrag (frag) {
28
         return 'a=ice-ufrag:' + frag;
28
         return 'a=ice-ufrag:' + frag;
29
     },
29
     },
30
-    parse_icepwd: function (line) {
30
+    parse_icepwd (line) {
31
         return line.substring(10);
31
         return line.substring(10);
32
     },
32
     },
33
-    build_icepwd: function (pwd) {
33
+    build_icepwd (pwd) {
34
         return 'a=ice-pwd:' + pwd;
34
         return 'a=ice-pwd:' + pwd;
35
     },
35
     },
36
-    parse_mid: function (line) {
36
+    parse_mid (line) {
37
         return line.substring(6);
37
         return line.substring(6);
38
     },
38
     },
39
-    parse_mline: function (line) {
39
+    parse_mline (line) {
40
         var parts = line.substring(2).split(' '),
40
         var parts = line.substring(2).split(' '),
41
             data = {};
41
             data = {};
42
         data.media = parts.shift();
42
         data.media = parts.shift();
48
         data.fmt = parts;
48
         data.fmt = parts;
49
         return data;
49
         return data;
50
     },
50
     },
51
-    build_mline: function (mline) {
51
+    build_mline (mline) {
52
         return 'm=' + mline.media + ' ' + mline.port + ' ' + mline.proto + ' ' + mline.fmt.join(' ');
52
         return 'm=' + mline.media + ' ' + mline.port + ' ' + mline.proto + ' ' + mline.fmt.join(' ');
53
     },
53
     },
54
-    parse_rtpmap: function (line) {
54
+    parse_rtpmap (line) {
55
         var parts = line.substring(9).split(' '),
55
         var parts = line.substring(9).split(' '),
56
             data = {};
56
             data = {};
57
         data.id = parts.shift();
57
         data.id = parts.shift();
66
      * @param line eg. "a=sctpmap:5000 webrtc-datachannel"
66
      * @param line eg. "a=sctpmap:5000 webrtc-datachannel"
67
      * @returns [SCTP port number, protocol, streams]
67
      * @returns [SCTP port number, protocol, streams]
68
      */
68
      */
69
-    parse_sctpmap: function (line) {
69
+    parse_sctpmap (line) {
70
         var parts = line.substring(10).split(' ');
70
         var parts = line.substring(10).split(' ');
71
         var sctpPort = parts[0];
71
         var sctpPort = parts[0];
72
         var protocol = parts[1];
72
         var protocol = parts[1];
74
         var streamCount = parts.length > 2 ? parts[2] : null;
74
         var streamCount = parts.length > 2 ? parts[2] : null;
75
         return [sctpPort, protocol, streamCount];// SCTP port
75
         return [sctpPort, protocol, streamCount];// SCTP port
76
     },
76
     },
77
-    build_rtpmap: function (el) {
77
+    build_rtpmap (el) {
78
         var line = 'a=rtpmap:' + el.getAttribute('id') + ' ' + el.getAttribute('name') + '/' + el.getAttribute('clockrate');
78
         var line = 'a=rtpmap:' + el.getAttribute('id') + ' ' + el.getAttribute('name') + '/' + el.getAttribute('clockrate');
79
         if (el.getAttribute('channels') && el.getAttribute('channels') != '1') {
79
         if (el.getAttribute('channels') && el.getAttribute('channels') != '1') {
80
             line += '/' + el.getAttribute('channels');
80
             line += '/' + el.getAttribute('channels');
81
         }
81
         }
82
         return line;
82
         return line;
83
     },
83
     },
84
-    parse_crypto: function (line) {
84
+    parse_crypto (line) {
85
         var parts = line.substring(9).split(' '),
85
         var parts = line.substring(9).split(' '),
86
             data = {};
86
             data = {};
87
         data.tag = parts.shift();
87
         data.tag = parts.shift();
92
         }
92
         }
93
         return data;
93
         return data;
94
     },
94
     },
95
-    parse_fingerprint: function (line) { // RFC 4572
95
+    parse_fingerprint (line) { // RFC 4572
96
         var parts = line.substring(14).split(' '),
96
         var parts = line.substring(14).split(' '),
97
             data = {};
97
             data = {};
98
         data.hash = parts.shift();
98
         data.hash = parts.shift();
100
         // TODO assert that fingerprint satisfies 2UHEX *(":" 2UHEX) ?
100
         // TODO assert that fingerprint satisfies 2UHEX *(":" 2UHEX) ?
101
         return data;
101
         return data;
102
     },
102
     },
103
-    parse_fmtp: function (line) {
103
+    parse_fmtp (line) {
104
         var parts = line.split(' '),
104
         var parts = line.split(' '),
105
             i, key, value,
105
             i, key, value,
106
             data = [];
106
             data = [];
113
             }
113
             }
114
             value = parts[i].split('=')[1];
114
             value = parts[i].split('=')[1];
115
             if (key && value) {
115
             if (key && value) {
116
-                data.push({name: key, value: value});
116
+                data.push({name: key, value});
117
             } else if (key) {
117
             } else if (key) {
118
                 // rfc 4733 (DTMF) style stuff
118
                 // rfc 4733 (DTMF) style stuff
119
                 data.push({name: '', value: key});
119
                 data.push({name: '', value: key});
121
         }
121
         }
122
         return data;
122
         return data;
123
     },
123
     },
124
-    parse_icecandidate: function (line) {
124
+    parse_icecandidate (line) {
125
         var candidate = {},
125
         var candidate = {},
126
             elems = line.split(' ');
126
             elems = line.split(' ');
127
         candidate.foundation = elems[0].substring(12);
127
         candidate.foundation = elems[0].substring(12);
155
         candidate.id = Math.random().toString(36).substr(2, 10); // not applicable to SDP -- FIXME: should be unique, not just random
155
         candidate.id = Math.random().toString(36).substr(2, 10); // not applicable to SDP -- FIXME: should be unique, not just random
156
         return candidate;
156
         return candidate;
157
     },
157
     },
158
-    build_icecandidate: function (cand) {
158
+    build_icecandidate (cand) {
159
         var line = ['a=candidate:' + cand.foundation, cand.component, cand.protocol, cand.priority, cand.ip, cand.port, 'typ', cand.type].join(' ');
159
         var line = ['a=candidate:' + cand.foundation, cand.component, cand.protocol, cand.priority, cand.ip, cand.port, 'typ', cand.type].join(' ');
160
         line += ' ';
160
         line += ' ';
161
         switch (cand.type) {
161
         switch (cand.type) {
185
         line += cand.hasOwnAttribute('generation') ? cand.generation : '0';
185
         line += cand.hasOwnAttribute('generation') ? cand.generation : '0';
186
         return line;
186
         return line;
187
     },
187
     },
188
-    parse_ssrc: function (desc) {
188
+    parse_ssrc (desc) {
189
         // proprietary mapping of a=ssrc lines
189
         // proprietary mapping of a=ssrc lines
190
         // TODO: see "Jingle RTP Source Description" by Juberti and P. Thatcher on google docs
190
         // TODO: see "Jingle RTP Source Description" by Juberti and P. Thatcher on google docs
191
         // and parse according to that
191
         // and parse according to that
199
         }
199
         }
200
         return data;
200
         return data;
201
     },
201
     },
202
-    parse_rtcpfb: function (line) {
202
+    parse_rtcpfb (line) {
203
         var parts = line.substr(10).split(' ');
203
         var parts = line.substr(10).split(' ');
204
         var data = {};
204
         var data = {};
205
         data.pt = parts.shift();
205
         data.pt = parts.shift();
207
         data.params = parts;
207
         data.params = parts;
208
         return data;
208
         return data;
209
     },
209
     },
210
-    parse_extmap: function (line) {
210
+    parse_extmap (line) {
211
         var parts = line.substr(9).split(' ');
211
         var parts = line.substr(9).split(' ');
212
         var data = {};
212
         var data = {};
213
         data.value = parts.shift();
213
         data.value = parts.shift();
221
         data.params = parts;
221
         data.params = parts;
222
         return data;
222
         return data;
223
     },
223
     },
224
-    find_line: function (haystack, needle, sessionpart) {
224
+    find_line (haystack, needle, sessionpart) {
225
         var lines = haystack.split('\r\n');
225
         var lines = haystack.split('\r\n');
226
         for (var i = 0; i < lines.length; i++) {
226
         for (var i = 0; i < lines.length; i++) {
227
             if (lines[i].substring(0, needle.length) == needle) {
227
             if (lines[i].substring(0, needle.length) == needle) {
240
         }
240
         }
241
         return false;
241
         return false;
242
     },
242
     },
243
-    find_lines: function (haystack, needle, sessionpart) {
243
+    find_lines (haystack, needle, sessionpart) {
244
         var lines = haystack.split('\r\n'),
244
         var lines = haystack.split('\r\n'),
245
             needles = [];
245
             needles = [];
246
         for (var i = 0; i < lines.length; i++) {
246
         for (var i = 0; i < lines.length; i++) {
260
         }
260
         }
261
         return needles;
261
         return needles;
262
     },
262
     },
263
-    candidateToJingle: function (line) {
263
+    candidateToJingle (line) {
264
         // a=candidate:2979166662 1 udp 2113937151 192.168.2.100 57698 typ host generation 0
264
         // a=candidate:2979166662 1 udp 2113937151 192.168.2.100 57698 typ host generation 0
265
         //      <candidate component=... foundation=... generation=... id=... ip=... network=... port=... priority=... protocol=... type=.../>
265
         //      <candidate component=... foundation=... generation=... id=... ip=... network=... port=... priority=... protocol=... type=.../>
266
         if (line.indexOf('candidate:') === 0) {
266
         if (line.indexOf('candidate:') === 0) {
313
         candidate.id = Math.random().toString(36).substr(2, 10); // not applicable to SDP -- FIXME: should be unique, not just random
313
         candidate.id = Math.random().toString(36).substr(2, 10); // not applicable to SDP -- FIXME: should be unique, not just random
314
         return candidate;
314
         return candidate;
315
     },
315
     },
316
-    candidateFromJingle: function (cand) {
316
+    candidateFromJingle (cand) {
317
         var line = 'a=candidate:';
317
         var line = 'a=candidate:';
318
         line += cand.getAttribute('foundation');
318
         line += cand.getAttribute('foundation');
319
         line += ' ';
319
         line += ' ';
370
      * @param {object} mLine object as parsed from transform.parse
370
      * @param {object} mLine object as parsed from transform.parse
371
      * @return {number} the primary video ssrc from the given m line
371
      * @return {number} the primary video ssrc from the given m line
372
      */
372
      */
373
-    parsePrimaryVideoSsrc: function(videoMLine) {
373
+    parsePrimaryVideoSsrc(videoMLine) {
374
         const numSsrcs = videoMLine.ssrcs
374
         const numSsrcs = videoMLine.ssrcs
375
             .map(ssrcInfo => ssrcInfo.id)
375
             .map(ssrcInfo => ssrcInfo.id)
376
             .filter((ssrc, index, array) => array.indexOf(ssrc) === index)
376
             .filter((ssrc, index, array) => array.indexOf(ssrc) === index)
407
      * Generate an ssrc
407
      * Generate an ssrc
408
      * @returns {number} an ssrc
408
      * @returns {number} an ssrc
409
      */
409
      */
410
-    generateSsrc: function() {
410
+    generateSsrc() {
411
         return RandomUtil.randomInt(1, 0xffffffff);
411
         return RandomUtil.randomInt(1, 0xffffffff);
412
     },
412
     },
413
 
413
 
420
      * @returns {string} the value corresponding to the given ssrc
420
      * @returns {string} the value corresponding to the given ssrc
421
      *  and attributeName
421
      *  and attributeName
422
      */
422
      */
423
-    getSsrcAttribute: function (mLine, ssrc, attributeName) {
423
+    getSsrcAttribute (mLine, ssrc, attributeName) {
424
         for (let i = 0; i < mLine.ssrcs.length; ++i) {
424
         for (let i = 0; i < mLine.ssrcs.length; ++i) {
425
             const ssrcLine = mLine.ssrcs[i];
425
             const ssrcLine = mLine.ssrcs[i];
426
             if (ssrcLine.id === ssrc &&
426
             if (ssrcLine.id === ssrc &&
438
      * @returns {list<number>} a list of the ssrcs in the group
438
      * @returns {list<number>} a list of the ssrcs in the group
439
      *  parsed as numbers
439
      *  parsed as numbers
440
      */
440
      */
441
-    parseGroupSsrcs: function (ssrcGroup) {
441
+    parseGroupSsrcs (ssrcGroup) {
442
         return ssrcGroup
442
         return ssrcGroup
443
             .ssrcs
443
             .ssrcs
444
             .split(" ")
444
             .split(" ")
451
      * @param {string} type the type of the desired mline (e.g. "video")
451
      * @param {string} type the type of the desired mline (e.g. "video")
452
      * @returns {object} a media object
452
      * @returns {object} a media object
453
      */
453
      */
454
-    getMedia: function (sdp, type) {
454
+    getMedia (sdp, type) {
455
         return sdp.media.find(m => m.type === type);
455
         return sdp.media.find(m => m.type === type);
456
     },
456
     },
457
     /**
457
     /**
465
      *  an sdp as parsed by transform.parse
465
      *  an sdp as parsed by transform.parse
466
      * @param {string} the name of the preferred codec
466
      * @param {string} the name of the preferred codec
467
      */
467
      */
468
-    preferVideoCodec: function(videoMLine, codecName) {
468
+    preferVideoCodec(videoMLine, codecName) {
469
         let payloadType = null;
469
         let payloadType = null;
470
         for (let i = 0; i < videoMLine.rtp.length; ++i) {
470
         for (let i = 0; i < videoMLine.rtp.length; ++i) {
471
             const rtp = videoMLine.rtp[i];
471
             const rtp = videoMLine.rtp[i];

+ 1
- 1
modules/xmpp/recording.js 查看文件

166
     elem.c('conference', {
166
     elem.c('conference', {
167
         xmlns: 'http://jitsi.org/protocol/colibri'
167
         xmlns: 'http://jitsi.org/protocol/colibri'
168
     });
168
     });
169
-    elem.c('recording', {state: state, token: options.token});
169
+    elem.c('recording', {state, token: options.token});
170
 
170
 
171
     var self = this;
171
     var self = this;
172
     this.connection.sendIQ(elem,
172
     this.connection.sendIQ(elem,

+ 2
- 2
modules/xmpp/strophe.rayo.js 查看文件

30
             });
30
             });
31
             req.c('dial', {
31
             req.c('dial', {
32
                 xmlns: RAYO_XMLNS,
32
                 xmlns: RAYO_XMLNS,
33
-                to: to,
34
-                from: from
33
+                to,
34
+                from
35
             });
35
             });
36
             req.c('header', {
36
             req.c('header', {
37
                 name: 'JvbRoomName',
37
                 name: 'JvbRoomName',

+ 2
- 2
modules/xmpp/xmpp.js 查看文件

246
 
246
 
247
     connect (jid, password) {
247
     connect (jid, password) {
248
         this.connectParams = {
248
         this.connectParams = {
249
-            jid: jid,
250
-            password: password
249
+            jid,
250
+            password
251
         };
251
         };
252
         if (!jid) {
252
         if (!jid) {
253
             let configDomain
253
             let configDomain

+ 1
- 1
webpack.config.js 查看文件

82
         libraryTarget: 'umd',
82
         libraryTarget: 'umd',
83
         sourceMapFilename: '[name].' + (minimize ? 'min' : 'js') + '.map'
83
         sourceMapFilename: '[name].' + (minimize ? 'min' : 'js') + '.map'
84
     },
84
     },
85
-    plugins: plugins
85
+    plugins
86
 };
86
 };

Loading…
取消
儲存