|
@@ -85,6 +85,18 @@ function changeEventStatus(postis, event, status) {
|
85
|
85
|
});
|
86
|
86
|
}
|
87
|
87
|
|
|
88
|
+/**
|
|
89
|
+ * Adds given number to the numberOfParticipants property of given APIInstance.
|
|
90
|
+ * @param {JitsiMeetExternalAPI} APIInstance the instance of the
|
|
91
|
+ * JitsiMeetExternalAPI
|
|
92
|
+ * @param {int} number - the number of participants to be added to
|
|
93
|
+ * numberOfParticipants property (this parameter can be negative number if the
|
|
94
|
+ * numberOfParticipants should be decreased).
|
|
95
|
+ */
|
|
96
|
+function changeParticipantNumber(APIInstance, number) {
|
|
97
|
+ APIInstance.numberOfParticipants += number;
|
|
98
|
+}
|
|
99
|
+
|
88
|
100
|
/**
|
89
|
101
|
* Constructs new API instance. Creates iframe element that loads
|
90
|
102
|
* Jitsi Meet.
|
|
@@ -161,6 +173,9 @@ function JitsiMeetExternalAPI(domain, room_name, width, height, parentNode,
|
161
|
173
|
|
162
|
174
|
this.eventHandlers = {};
|
163
|
175
|
|
|
176
|
+ this.numberOfParticipants = 1;
|
|
177
|
+ this._setupListeners();
|
|
178
|
+
|
164
|
179
|
id++;
|
165
|
180
|
}
|
166
|
181
|
|
|
@@ -346,6 +361,25 @@ JitsiMeetExternalAPI.prototype.removeEventListeners = function(events) {
|
346
|
361
|
this.removeEventListener(events[i]);
|
347
|
362
|
};
|
348
|
363
|
|
|
364
|
+/**
|
|
365
|
+ * Returns the number of participants in the conference.
|
|
366
|
+ * NOTE: the local participant is included.
|
|
367
|
+ * @returns {int} the number of participants in the conference.
|
|
368
|
+ */
|
|
369
|
+JitsiMeetExternalAPI.prototype.getNumberOfParticipant = function() {
|
|
370
|
+ return this.numberOfParticipants;
|
|
371
|
+};
|
|
372
|
+
|
|
373
|
+/**
|
|
374
|
+ * Setups listeners that are used internally for JitsiMeetExternalAPI.
|
|
375
|
+ */
|
|
376
|
+JitsiMeetExternalAPI.prototype._setupListeners = function() {
|
|
377
|
+ this.postis.listen("participant-joined",
|
|
378
|
+ changeParticipantNumber.bind(null, this, 1));
|
|
379
|
+ this.postis.listen("participant-left",
|
|
380
|
+ changeParticipantNumber.bind(null, this, -1));
|
|
381
|
+};
|
|
382
|
+
|
349
|
383
|
/**
|
350
|
384
|
* Removes the listeners and removes the Jitsi Meet frame.
|
351
|
385
|
*/
|