|
@@ -1,4 +1,4 @@
|
1
|
|
-/* global Strophe, $, Promise */
|
|
1
|
+/* global Strophe, $ */
|
2
|
2
|
/* jshint -W101 */
|
3
|
3
|
var logger = require("jitsi-meet-logger").getLogger(__filename);
|
4
|
4
|
var RTC = require("./modules/RTC/RTC");
|
|
@@ -6,7 +6,6 @@ var XMPPEvents = require("./service/xmpp/XMPPEvents");
|
6
|
6
|
var RTCEvents = require("./service/RTC/RTCEvents");
|
7
|
7
|
var EventEmitter = require("events");
|
8
|
8
|
var JitsiConferenceEvents = require("./JitsiConferenceEvents");
|
9
|
|
-var JitsiConferenceErrors = require("./JitsiConferenceErrors");
|
10
|
9
|
var JitsiParticipant = require("./JitsiParticipant");
|
11
|
10
|
var Statistics = require("./modules/statistics/statistics");
|
12
|
11
|
var JitsiDTMFManager = require('./modules/DTMF/JitsiDTMFManager');
|
|
@@ -52,13 +51,6 @@ JitsiConference.prototype.join = function (password) {
|
52
|
51
|
this.room.join(password, this.connection.tokenPassword);
|
53
|
52
|
};
|
54
|
53
|
|
55
|
|
-/**
|
56
|
|
- * Check if joined to the conference.
|
57
|
|
- */
|
58
|
|
-JitsiConference.prototype.isJoined = function () {
|
59
|
|
- return this.room && this.room.joined;
|
60
|
|
-};
|
61
|
|
-
|
62
|
54
|
/**
|
63
|
55
|
* Leaves the conference.
|
64
|
56
|
*/
|
|
@@ -68,40 +60,6 @@ JitsiConference.prototype.leave = function () {
|
68
|
60
|
this.room = null;
|
69
|
61
|
};
|
70
|
62
|
|
71
|
|
-/**
|
72
|
|
- * Returns name of this conference.
|
73
|
|
- */
|
74
|
|
-JitsiConference.prototype.getName = function () {
|
75
|
|
- return this.options.name;
|
76
|
|
-};
|
77
|
|
-
|
78
|
|
-/**
|
79
|
|
- * Check if external authentication is enabled for this conference.
|
80
|
|
- */
|
81
|
|
-JitsiConference.prototype.isExternalAuthEnabled = function () {
|
82
|
|
- return this.room && this.room.moderator.isExternalAuthEnabled();
|
83
|
|
-};
|
84
|
|
-
|
85
|
|
-/**
|
86
|
|
- * Get url for external authentication.
|
87
|
|
- * @param {boolean} [urlForPopup] if true then return url for login popup,
|
88
|
|
- * else url of login page.
|
89
|
|
- * @returns {Promise}
|
90
|
|
- */
|
91
|
|
-JitsiConference.prototype.getExternalAuthUrl = function (urlForPopup) {
|
92
|
|
- return new Promise(function (resolve, reject) {
|
93
|
|
- if (!this.isExternalAuthEnabled()) {
|
94
|
|
- reject();
|
95
|
|
- return;
|
96
|
|
- }
|
97
|
|
- if (urlForPopup) {
|
98
|
|
- this.room.moderator.getPopupLoginUrl(resolve, reject);
|
99
|
|
- } else {
|
100
|
|
- this.room.moderator.getLoginUrl(resolve, reject);
|
101
|
|
- }
|
102
|
|
- }.bind(this));
|
103
|
|
-};
|
104
|
|
-
|
105
|
63
|
/**
|
106
|
64
|
* Returns the local tracks.
|
107
|
65
|
*/
|
|
@@ -264,11 +222,6 @@ JitsiConference.prototype._fireMuteChangeEvent = function (track) {
|
264
|
222
|
* @param track the JitsiLocalTrack object.
|
265
|
223
|
*/
|
266
|
224
|
JitsiConference.prototype.removeTrack = function (track) {
|
267
|
|
- if(!this.room){
|
268
|
|
- if(this.rtc)
|
269
|
|
- this.rtc.removeLocalStream(track);
|
270
|
|
- return;
|
271
|
|
- }
|
272
|
225
|
this.room.removeStream(track.getOriginalStream(), function(){
|
273
|
226
|
this.rtc.removeLocalStream(track);
|
274
|
227
|
this.eventEmitter.emit(JitsiConferenceEvents.TRACK_REMOVED, track);
|
|
@@ -291,36 +244,6 @@ JitsiConference.prototype.isModerator = function () {
|
291
|
244
|
return this.room.isModerator();
|
292
|
245
|
};
|
293
|
246
|
|
294
|
|
-/**
|
295
|
|
- * Set password for the room.
|
296
|
|
- * @param {string} password new password for the room.
|
297
|
|
- * @returns {Promise}
|
298
|
|
- */
|
299
|
|
-JitsiConference.prototype.lock = function (password) {
|
300
|
|
- if (!this.isModerator()) {
|
301
|
|
- return Promise.reject();
|
302
|
|
- }
|
303
|
|
-
|
304
|
|
- var conference = this;
|
305
|
|
- return new Promise(function (resolve, reject) {
|
306
|
|
- conference.xmpp.lockRoom(password, function () {
|
307
|
|
- resolve();
|
308
|
|
- }, function (err) {
|
309
|
|
- reject(err);
|
310
|
|
- }, function () {
|
311
|
|
- reject(JitsiConferenceErrors.PASSWORD_NOT_SUPPORTED);
|
312
|
|
- });
|
313
|
|
- });
|
314
|
|
-};
|
315
|
|
-
|
316
|
|
-/**
|
317
|
|
- * Remove password from the room.
|
318
|
|
- * @returns {Promise}
|
319
|
|
- */
|
320
|
|
-JitsiConference.prototype.unlock = function () {
|
321
|
|
- return this.lock(undefined);
|
322
|
|
-};
|
323
|
|
-
|
324
|
247
|
/**
|
325
|
248
|
* Elects the participant with the given id to be the selected participant or the speaker.
|
326
|
249
|
* @param id the identifier of the participant
|
|
@@ -362,13 +285,10 @@ JitsiConference.prototype.getParticipantById = function(id) {
|
362
|
285
|
|
363
|
286
|
JitsiConference.prototype.onMemberJoined = function (jid, email, nick) {
|
364
|
287
|
var id = Strophe.getResourceFromJid(jid);
|
365
|
|
- if (id === 'focus') {
|
366
|
|
- return;
|
367
|
|
- }
|
368
|
288
|
var participant = new JitsiParticipant(id, this, nick);
|
|
289
|
+ this.eventEmitter.emit(JitsiConferenceEvents.USER_JOINED, id);
|
369
|
290
|
this.participants[id] = participant;
|
370
|
|
- this.eventEmitter.emit(JitsiConferenceEvents.USER_JOINED, id, participant);
|
371
|
|
- this.xmpp.connection.disco.info(
|
|
291
|
+ this.connection.xmpp.connection.disco.info(
|
372
|
292
|
jid, "node", function(iq) {
|
373
|
293
|
participant._supportsDTMF = $(iq).find(
|
374
|
294
|
'>query>feature[var="urn:xmpp:jingle:dtmf:0"]').length > 0;
|
|
@@ -379,9 +299,8 @@ JitsiConference.prototype.onMemberJoined = function (jid, email, nick) {
|
379
|
299
|
|
380
|
300
|
JitsiConference.prototype.onMemberLeft = function (jid) {
|
381
|
301
|
var id = Strophe.getResourceFromJid(jid);
|
382
|
|
- var participant = this.participants[id];
|
383
|
302
|
delete this.participants[id];
|
384
|
|
- this.eventEmitter.emit(JitsiConferenceEvents.USER_LEFT, id, participant);
|
|
303
|
+ this.eventEmitter.emit(JitsiConferenceEvents.USER_LEFT, id);
|
385
|
304
|
};
|
386
|
305
|
|
387
|
306
|
JitsiConference.prototype.onUserRoleChanged = function (jid, role) {
|
|
@@ -477,7 +396,7 @@ JitsiConference.prototype.myUserId = function () {
|
477
|
396
|
|
478
|
397
|
JitsiConference.prototype.sendTones = function (tones, duration, pause) {
|
479
|
398
|
if (!this.dtmfManager) {
|
480
|
|
- var connection = this.xmpp.connection.jingle.activecall.peerconnection;
|
|
399
|
+ var connection = this.connection.xmpp.connection.jingle.activecall.peerconnection;
|
481
|
400
|
if (!connection) {
|
482
|
401
|
logger.warn("cannot sendTones: no conneciton");
|
483
|
402
|
return;
|
|
@@ -497,13 +416,40 @@ JitsiConference.prototype.sendTones = function (tones, duration, pause) {
|
497
|
416
|
};
|
498
|
417
|
|
499
|
418
|
/**
|
500
|
|
- * Returns the connection state for the current room. Its ice connection state
|
501
|
|
- * for its session.
|
|
419
|
+ * Returns true if the recording is supproted and false if not.
|
502
|
420
|
*/
|
503
|
|
-JitsiConference.prototype.getConnectionState = function () {
|
504
|
|
- if(this.room)
|
505
|
|
- return this.room.getConnectionState();
|
506
|
|
- return null;
|
|
421
|
+JitsiConference.prototype.isRecordingSupported = function () {
|
|
422
|
+ // if(this.room)
|
|
423
|
+ // return this.room.isRecordingSupported();
|
|
424
|
+ // return false;
|
|
425
|
+};
|
|
426
|
+
|
|
427
|
+/**
|
|
428
|
+ * Returns null if the recording is not supported, "on" if the recording started
|
|
429
|
+ * and "off" if the recording is not started.
|
|
430
|
+ */
|
|
431
|
+JitsiConference.prototype.getRecordingState = function () {
|
|
432
|
+ // if(this.room)
|
|
433
|
+ // return this.room.getRecordingState();
|
|
434
|
+ // return "off";
|
|
435
|
+}
|
|
436
|
+
|
|
437
|
+/**
|
|
438
|
+ * Returns the url of the recorded video.
|
|
439
|
+ */
|
|
440
|
+JitsiConference.prototype.getRecordingURL = function () {
|
|
441
|
+ // if(this.room)
|
|
442
|
+ // return this.room.getRecordingURL();
|
|
443
|
+ // return null;
|
|
444
|
+}
|
|
445
|
+
|
|
446
|
+/**
|
|
447
|
+ * Starts/stops the recording
|
|
448
|
+ * @param token a token for authentication.
|
|
449
|
+ */
|
|
450
|
+JitsiConference.prototype.toggleRecording = function (token) {
|
|
451
|
+ // if(this.room)
|
|
452
|
+ // this.room.toggleRecording(token);
|
507
|
453
|
}
|
508
|
454
|
|
509
|
455
|
/**
|
|
@@ -529,18 +475,6 @@ function setupListeners(conference) {
|
529
|
475
|
conference.room.addListener(XMPPEvents.MUC_JOINED, function () {
|
530
|
476
|
conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_JOINED);
|
531
|
477
|
});
|
532
|
|
- conference.room.addListener(XMPPEvents.ROOM_JOIN_ERROR, function (pres) {
|
533
|
|
- conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.CONNECTION_ERROR, pres);
|
534
|
|
- });
|
535
|
|
- conference.room.addListener(XMPPEvents.ROOM_CONNECT_ERROR, function (pres) {
|
536
|
|
- conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.CONNECTION_ERROR, pres);
|
537
|
|
- });
|
538
|
|
- conference.room.addListener(XMPPEvents.PASSWORD_REQUIRED, function (pres) {
|
539
|
|
- conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.PASSWORD_REQUIRED, pres);
|
540
|
|
- });
|
541
|
|
- conference.room.addListener(XMPPEvents.AUTHENTICATION_REQUIRED, function () {
|
542
|
|
- conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.AUTHENTICATION_REQUIRED);
|
543
|
|
- });
|
544
|
478
|
// FIXME
|
545
|
479
|
// conference.room.addListener(XMPPEvents.MUC_JOINED, function () {
|
546
|
480
|
// conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_LEFT);
|
|
@@ -564,12 +498,7 @@ function setupListeners(conference) {
|
564
|
498
|
conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_RESTORED);
|
565
|
499
|
});
|
566
|
500
|
conference.room.addListener(XMPPEvents.CONFERENCE_SETUP_FAILED, function () {
|
567
|
|
- conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.SETUP_FAILED);
|
568
|
|
- });
|
569
|
|
-
|
570
|
|
- conference.room.addListener(XMPPEvents.MESSAGE_RECEIVED, function (jid, displayName, txt, myJid, ts) {
|
571
|
|
- var id = Strophe.getResourceFromJid(jid);
|
572
|
|
- conference.eventEmitter.emit(JitsiConferenceEvents.MESSAGE_RECEIVED, id, txt, ts);
|
|
501
|
+ conference.eventEmitter.emit(JitsiConferenceEvents.SETUP_FAILED);
|
573
|
502
|
});
|
574
|
503
|
|
575
|
504
|
conference.rtc.addListener(RTCEvents.DOMINANTSPEAKER_CHANGED, function (id) {
|
|
@@ -588,9 +517,6 @@ function setupListeners(conference) {
|
588
|
517
|
conference.eventEmitter.emit(JitsiConferenceEvents.LAST_N_ENDPOINTS_CHANGED,
|
589
|
518
|
lastNEndpoints, endpointsEnteringLastN);
|
590
|
519
|
});
|
591
|
|
- conference.xmpp.addListener(XMPPEvents.PASSWORD_REQUIRED, function () {
|
592
|
|
- conference.eventEmitter.emit(JitsiConferenceErrors.PASSWORD_REQUIRED);
|
593
|
|
- });
|
594
|
520
|
|
595
|
521
|
if(conference.statistics) {
|
596
|
522
|
//FIXME: Maybe remove event should not be associated with the conference.
|