mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-05-20 16:07:49 +00:00
fix(external_api): Fix number of participants in meeting (#12052)
This commit is contained in:
committed by
yanas
parent
fb402c7131
commit
b709d079c9
39
modules/API/external/external_api.js
vendored
39
modules/API/external/external_api.js
vendored
@@ -619,6 +619,9 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
|
||||
case 'video-quality-changed':
|
||||
this._videoQuality = data.videoQuality;
|
||||
break;
|
||||
case 'breakout-rooms-updated':
|
||||
this.updateNumberOfParticipants(data.rooms);
|
||||
break;
|
||||
case 'local-storage-changed':
|
||||
jitsiLocalStorage.setItem('jitsiLocalStorage', data.localStorageContent);
|
||||
|
||||
@@ -638,6 +641,40 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Update number of participants based on all rooms.
|
||||
*
|
||||
* @param {Object} rooms - Rooms available rooms in the conference.
|
||||
* @returns {void}
|
||||
*/
|
||||
updateNumberOfParticipants(rooms) {
|
||||
if (!rooms || !Object.keys(rooms).length) {
|
||||
return;
|
||||
}
|
||||
|
||||
const allParticipants = Object.keys(rooms).reduce((prev, roomItemKey) => {
|
||||
if (rooms[roomItemKey]?.participants) {
|
||||
return Object.keys(rooms[roomItemKey].participants).length + prev;
|
||||
}
|
||||
|
||||
return prev;
|
||||
}, 0);
|
||||
|
||||
this._numberOfParticipants = allParticipants;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the rooms info in the conference.
|
||||
*
|
||||
* @returns {Object} Rooms info.
|
||||
*/
|
||||
async getRoomsInfo() {
|
||||
return this._transport.sendRequest({
|
||||
name: 'rooms-info'
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds event listener to Meet Jitsi.
|
||||
*
|
||||
@@ -1101,7 +1138,7 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of participants in the conference. The local
|
||||
* Returns the number of participants in the conference from all rooms. The local
|
||||
* participant is included.
|
||||
*
|
||||
* @returns {int} The number of participants in the conference.
|
||||
|
||||
Reference in New Issue
Block a user