|
|
@@ -34,7 +34,7 @@ import ConnectionQuality from "./modules/connectivity/ConnectionQuality";
|
|
34
|
34
|
* @constructor
|
|
35
|
35
|
*/
|
|
36
|
36
|
function JitsiConference(options) {
|
|
37
|
|
- if(!options.name || options.name.toLowerCase() !== options.name) {
|
|
|
37
|
+ if (!options.name || options.name.toLowerCase() !== options.name) {
|
|
38
|
38
|
var errmsg
|
|
39
|
39
|
= "Invalid conference name (no conference name passed or it "
|
|
40
|
40
|
+ "contains invalid characters like capital letters)!";
|
|
|
@@ -92,12 +92,12 @@ function JitsiConference(options) {
|
|
92
|
92
|
* @param connection {JitsiConnection} overrides this.connection
|
|
93
|
93
|
*/
|
|
94
|
94
|
JitsiConference.prototype._init = function (options) {
|
|
95
|
|
- if(!options)
|
|
|
95
|
+ if (!options)
|
|
96
|
96
|
options = {};
|
|
97
|
97
|
|
|
98
|
98
|
// Override connection and xmpp properties (Usefull if the connection
|
|
99
|
99
|
// reloaded)
|
|
100
|
|
- if(options.connection) {
|
|
|
100
|
+ if (options.connection) {
|
|
101
|
101
|
this.connection = options.connection;
|
|
102
|
102
|
this.xmpp = this.connection.xmpp;
|
|
103
|
103
|
// Setup XMPP events only if we have new connection object.
|
|
|
@@ -108,7 +108,7 @@ JitsiConference.prototype._init = function (options) {
|
|
108
|
108
|
|
|
109
|
109
|
this.room.updateDeviceAvailability(RTC.getDeviceAvailability());
|
|
110
|
110
|
|
|
111
|
|
- if(!this.rtc) {
|
|
|
111
|
+ if (!this.rtc) {
|
|
112
|
112
|
this.rtc = new RTC(this, options);
|
|
113
|
113
|
this.eventManager.setupRTCListeners();
|
|
114
|
114
|
}
|
|
|
@@ -119,7 +119,7 @@ JitsiConference.prototype._init = function (options) {
|
|
119
|
119
|
options.config.peerDisconnectedThroughRtcTimeout);
|
|
120
|
120
|
this.participantConnectionStatus.init();
|
|
121
|
121
|
|
|
122
|
|
- if(!this.statistics) {
|
|
|
122
|
+ if (!this.statistics) {
|
|
123
|
123
|
this.statistics = new Statistics(this.xmpp, {
|
|
124
|
124
|
callStatsID: this.options.config.callStatsID,
|
|
125
|
125
|
callStatsSecret: this.options.config.callStatsSecret,
|
|
|
@@ -149,7 +149,7 @@ JitsiConference.prototype._init = function (options) {
|
|
149
|
149
|
* @param password {string} the password
|
|
150
|
150
|
*/
|
|
151
|
151
|
JitsiConference.prototype.join = function (password) {
|
|
152
|
|
- if(this.room)
|
|
|
152
|
+ if (this.room)
|
|
153
|
153
|
this.room.join(password);
|
|
154
|
154
|
};
|
|
155
|
155
|
|
|
|
@@ -173,7 +173,7 @@ JitsiConference.prototype.leave = function () {
|
|
173
|
173
|
this.getLocalTracks().forEach(track => this.onTrackRemoved(track));
|
|
174
|
174
|
|
|
175
|
175
|
this.rtc.closeAllDataChannels();
|
|
176
|
|
- if(this.statistics)
|
|
|
176
|
+ if (this.statistics)
|
|
177
|
177
|
this.statistics.dispose();
|
|
178
|
178
|
|
|
179
|
179
|
// leave the conference
|
|
|
@@ -282,7 +282,7 @@ JitsiConference.prototype.getLocalTracks = function (mediaType) {
|
|
282
|
282
|
* Note: consider adding eventing functionality by extending an EventEmitter impl, instead of rolling ourselves
|
|
283
|
283
|
*/
|
|
284
|
284
|
JitsiConference.prototype.on = function (eventId, handler) {
|
|
285
|
|
- if(this.eventEmitter)
|
|
|
285
|
+ if (this.eventEmitter)
|
|
286
|
286
|
this.eventEmitter.on(eventId, handler);
|
|
287
|
287
|
};
|
|
288
|
288
|
|
|
|
@@ -294,7 +294,7 @@ JitsiConference.prototype.on = function (eventId, handler) {
|
|
294
|
294
|
* Note: consider adding eventing functionality by extending an EventEmitter impl, instead of rolling ourselves
|
|
295
|
295
|
*/
|
|
296
|
296
|
JitsiConference.prototype.off = function (eventId, handler) {
|
|
297
|
|
- if(this.eventEmitter)
|
|
|
297
|
+ if (this.eventEmitter)
|
|
298
|
298
|
this.eventEmitter.removeListener(eventId, handler);
|
|
299
|
299
|
};
|
|
300
|
300
|
|
|
|
@@ -309,7 +309,7 @@ JitsiConference.prototype.removeEventListener = JitsiConference.prototype.off;
|
|
309
|
309
|
* @param handler {Function} handler for the command
|
|
310
|
310
|
*/
|
|
311
|
311
|
JitsiConference.prototype.addCommandListener = function (command, handler) {
|
|
312
|
|
- if(this.room)
|
|
|
312
|
+ if (this.room)
|
|
313
|
313
|
this.room.addPresenceListener(command, handler);
|
|
314
|
314
|
};
|
|
315
|
315
|
|
|
|
@@ -318,7 +318,7 @@ JitsiConference.prototype.removeEventListener = JitsiConference.prototype.off;
|
|
318
|
318
|
* @param command {String} the name of the command
|
|
319
|
319
|
*/
|
|
320
|
320
|
JitsiConference.prototype.removeCommandListener = function (command) {
|
|
321
|
|
- if(this.room)
|
|
|
321
|
+ if (this.room)
|
|
322
|
322
|
this.room.removePresenceListener(command);
|
|
323
|
323
|
};
|
|
324
|
324
|
|
|
|
@@ -327,7 +327,7 @@ JitsiConference.prototype.removeEventListener = JitsiConference.prototype.off;
|
|
327
|
327
|
* @param message the text message.
|
|
328
|
328
|
*/
|
|
329
|
329
|
JitsiConference.prototype.sendTextMessage = function (message) {
|
|
330
|
|
- if(this.room)
|
|
|
330
|
+ if (this.room)
|
|
331
|
331
|
this.room.sendMessage(message);
|
|
332
|
332
|
};
|
|
333
|
333
|
|
|
|
@@ -337,7 +337,7 @@ JitsiConference.prototype.sendTextMessage = function (message) {
|
|
337
|
337
|
* @param values {Object} with keys and values that will be sent.
|
|
338
|
338
|
**/
|
|
339
|
339
|
JitsiConference.prototype.sendCommand = function (name, values) {
|
|
340
|
|
- if(this.room) {
|
|
|
340
|
+ if (this.room) {
|
|
341
|
341
|
this.room.addToPresence(name, values);
|
|
342
|
342
|
this.room.sendPresence();
|
|
343
|
343
|
}
|
|
|
@@ -358,7 +358,7 @@ JitsiConference.prototype.sendCommandOnce = function (name, values) {
|
|
358
|
358
|
* @param name {String} the name of the command.
|
|
359
|
359
|
**/
|
|
360
|
360
|
JitsiConference.prototype.removeCommand = function (name) {
|
|
361
|
|
- if(this.room)
|
|
|
361
|
+ if (this.room)
|
|
362
|
362
|
this.room.removeFromPresence(name);
|
|
363
|
363
|
};
|
|
364
|
364
|
|
|
|
@@ -367,7 +367,7 @@ JitsiConference.prototype.removeCommand = function (name) {
|
|
367
|
367
|
* @param name the display name to set
|
|
368
|
368
|
*/
|
|
369
|
369
|
JitsiConference.prototype.setDisplayName = function(name) {
|
|
370
|
|
- if(this.room){
|
|
|
370
|
+ if (this.room){
|
|
371
|
371
|
// remove previously set nickname
|
|
372
|
372
|
this.room.removeFromPresence("nick");
|
|
373
|
373
|
|
|
|
@@ -391,17 +391,17 @@ JitsiConference.prototype.setSubject = function (subject) {
|
|
391
|
391
|
* @return {Transcriber} the transcriber object
|
|
392
|
392
|
*/
|
|
393
|
393
|
JitsiConference.prototype.getTranscriber = function(){
|
|
394
|
|
- if(this.transcriber === undefined){
|
|
|
394
|
+ if (this.transcriber === undefined){
|
|
395
|
395
|
this.transcriber = new Transcriber();
|
|
396
|
396
|
//add all existing local audio tracks to the transcriber
|
|
397
|
397
|
this.rtc.localTracks.forEach(function (localTrack) {
|
|
398
|
|
- if(localTrack.isAudioTrack()){
|
|
|
398
|
+ if (localTrack.isAudioTrack()){
|
|
399
|
399
|
this.transcriber.addTrack(localTrack);
|
|
400
|
400
|
}
|
|
401
|
401
|
}.bind(this));
|
|
402
|
402
|
//and all remote audio tracks
|
|
403
|
403
|
this.rtc.remoteTracks.forEach(function (remoteTrack){
|
|
404
|
|
- if(remoteTrack.isAudioTrack()){
|
|
|
404
|
+ if (remoteTrack.isAudioTrack()){
|
|
405
|
405
|
this.transcriber.addTrack(remoteTrack);
|
|
406
|
406
|
}
|
|
407
|
407
|
}.bind(this));
|
|
|
@@ -632,7 +632,7 @@ JitsiConference.prototype._setupNewTrack = function (newTrack) {
|
|
632
|
632
|
*/
|
|
633
|
633
|
JitsiConference.prototype._addLocalStream
|
|
634
|
634
|
= function (stream, callback, errorCallback, ssrcInfo, dontModifySources) {
|
|
635
|
|
- if(this.jingleSession) {
|
|
|
635
|
+ if (this.jingleSession) {
|
|
636
|
636
|
this.jingleSession.addStream(
|
|
637
|
637
|
stream, callback, errorCallback, ssrcInfo, dontModifySources);
|
|
638
|
638
|
} else {
|
|
|
@@ -652,7 +652,7 @@ JitsiConference.prototype._addLocalStream
|
|
652
|
652
|
*/
|
|
653
|
653
|
JitsiConference.prototype.removeLocalStream
|
|
654
|
654
|
= function (stream, callback, errorCallback, ssrcInfo) {
|
|
655
|
|
- if(this.jingleSession) {
|
|
|
655
|
+ if (this.jingleSession) {
|
|
656
|
656
|
this.jingleSession.removeStream(
|
|
657
|
657
|
stream, callback, errorCallback, ssrcInfo);
|
|
658
|
658
|
} else {
|
|
|
@@ -668,7 +668,7 @@ JitsiConference.prototype.removeLocalStream
|
|
668
|
668
|
* - groups - Array of the groups associated with the stream.
|
|
669
|
669
|
*/
|
|
670
|
670
|
JitsiConference.prototype._generateNewStreamSSRCInfo = function () {
|
|
671
|
|
- if(!this.jingleSession) {
|
|
|
671
|
+ if (!this.jingleSession) {
|
|
672
|
672
|
logger.warn("The call haven't been started. " +
|
|
673
|
673
|
"Cannot generate ssrc info at the moment!");
|
|
674
|
674
|
return null;
|
|
|
@@ -911,7 +911,7 @@ JitsiConference.prototype.onTrackAdded = function (track) {
|
|
911
|
911
|
// Add track to JitsiParticipant.
|
|
912
|
912
|
participant._tracks.push(track);
|
|
913
|
913
|
|
|
914
|
|
- if(this.transcriber){
|
|
|
914
|
+ if (this.transcriber){
|
|
915
|
915
|
this.transcriber.addTrack(track);
|
|
916
|
916
|
}
|
|
917
|
917
|
|
|
|
@@ -997,7 +997,7 @@ function (jingleSession, jingleOffer, now) {
|
|
997
|
997
|
* problems between sdp-interop and trying to keep the ssrcs
|
|
998
|
998
|
* consistent
|
|
999
|
999
|
*/
|
|
1000
|
|
- if(localTrack.isVideoTrack() && localTrack.isMuted() && !RTCBrowserType.isFirefox()) {
|
|
|
1000
|
+ if (localTrack.isVideoTrack() && localTrack.isMuted() && !RTCBrowserType.isFirefox()) {
|
|
1001
|
1001
|
/**
|
|
1002
|
1002
|
* Handles issues when the stream is added before the peerconnection
|
|
1003
|
1003
|
* is created. The peerconnection is created when second participant
|
|
|
@@ -1158,7 +1158,7 @@ JitsiConference.prototype.sendTones = function (tones, duration, pause) {
|
|
1158
|
1158
|
* Returns true if recording is supported and false if not.
|
|
1159
|
1159
|
*/
|
|
1160
|
1160
|
JitsiConference.prototype.isRecordingSupported = function () {
|
|
1161
|
|
- if(this.room)
|
|
|
1161
|
+ if (this.room)
|
|
1162
|
1162
|
return this.room.isRecordingSupported();
|
|
1163
|
1163
|
return false;
|
|
1164
|
1164
|
};
|
|
|
@@ -1182,7 +1182,7 @@ JitsiConference.prototype.getRecordingURL = function () {
|
|
1182
|
1182
|
* Starts/stops the recording
|
|
1183
|
1183
|
*/
|
|
1184
|
1184
|
JitsiConference.prototype.toggleRecording = function (options) {
|
|
1185
|
|
- if(this.room)
|
|
|
1185
|
+ if (this.room)
|
|
1186
|
1186
|
return this.room.toggleRecording(options, function (status, error) {
|
|
1187
|
1187
|
this.eventEmitter.emit(
|
|
1188
|
1188
|
JitsiConferenceEvents.RECORDER_STATE_CHANGED, status, error);
|
|
|
@@ -1196,7 +1196,7 @@ JitsiConference.prototype.toggleRecording = function (options) {
|
|
1196
|
1196
|
* Returns true if the SIP calls are supported and false otherwise
|
|
1197
|
1197
|
*/
|
|
1198
|
1198
|
JitsiConference.prototype.isSIPCallingSupported = function () {
|
|
1199
|
|
- if(this.room)
|
|
|
1199
|
+ if (this.room)
|
|
1200
|
1200
|
return this.room.isSIPCallingSupported();
|
|
1201
|
1201
|
return false;
|
|
1202
|
1202
|
};
|
|
|
@@ -1206,7 +1206,7 @@ JitsiConference.prototype.isSIPCallingSupported = function () {
|
|
1206
|
1206
|
* @param number the number
|
|
1207
|
1207
|
*/
|
|
1208
|
1208
|
JitsiConference.prototype.dial = function (number) {
|
|
1209
|
|
- if(this.room)
|
|
|
1209
|
+ if (this.room)
|
|
1210
|
1210
|
return this.room.dial(number);
|
|
1211
|
1211
|
return new Promise(function(resolve, reject){
|
|
1212
|
1212
|
reject(new Error("The conference is not created yet!"));});
|
|
|
@@ -1216,7 +1216,7 @@ JitsiConference.prototype.dial = function (number) {
|
|
1216
|
1216
|
* Hangup an existing call
|
|
1217
|
1217
|
*/
|
|
1218
|
1218
|
JitsiConference.prototype.hangup = function () {
|
|
1219
|
|
- if(this.room)
|
|
|
1219
|
+ if (this.room)
|
|
1220
|
1220
|
return this.room.hangup();
|
|
1221
|
1221
|
return new Promise(function(resolve, reject){
|
|
1222
|
1222
|
reject(new Error("The conference is not created yet!"));});
|
|
|
@@ -1226,7 +1226,7 @@ JitsiConference.prototype.hangup = function () {
|
|
1226
|
1226
|
* Returns the phone number for joining the conference.
|
|
1227
|
1227
|
*/
|
|
1228
|
1228
|
JitsiConference.prototype.getPhoneNumber = function () {
|
|
1229
|
|
- if(this.room)
|
|
|
1229
|
+ if (this.room)
|
|
1230
|
1230
|
return this.room.getPhoneNumber();
|
|
1231
|
1231
|
return null;
|
|
1232
|
1232
|
};
|
|
|
@@ -1235,7 +1235,7 @@ JitsiConference.prototype.getPhoneNumber = function () {
|
|
1235
|
1235
|
* Returns the pin for joining the conference with phone.
|
|
1236
|
1236
|
*/
|
|
1237
|
1237
|
JitsiConference.prototype.getPhonePin = function () {
|
|
1238
|
|
- if(this.room)
|
|
|
1238
|
+ if (this.room)
|
|
1239
|
1239
|
return this.room.getPhonePin();
|
|
1240
|
1240
|
return null;
|
|
1241
|
1241
|
};
|
|
|
@@ -1245,7 +1245,7 @@ JitsiConference.prototype.getPhonePin = function () {
|
|
1245
|
1245
|
* for its session.
|
|
1246
|
1246
|
*/
|
|
1247
|
1247
|
JitsiConference.prototype.getConnectionState = function () {
|
|
1248
|
|
- if(this.jingleSession) {
|
|
|
1248
|
+ if (this.jingleSession) {
|
|
1249
|
1249
|
return this.jingleSession.getIceConnectionState();
|
|
1250
|
1250
|
} else {
|
|
1251
|
1251
|
return null;
|