Merge pull request #617 from bgrozev/refactor-util

Exposes the number of participants with tracks.
This commit is contained in:
George Politis 2016-04-26 10:23:34 -05:00
commit 7bb20bb967
1 changed files with 6 additions and 13 deletions

View File

@ -474,20 +474,13 @@ export default {
return this.audioLevelsMap[id]; return this.audioLevelsMap[id];
}, },
/** /**
* Will check for number of remote particiapnts that have at least one * @return {number} the number of participants in the conference with at
* remote track. * least one track.
* @return {boolean} whether we have enough participants with remote streams
*/ */
checkEnoughParticipants (number) { getNumberOfParticipantsWithTracks() {
var participants = this._room.getParticipants(); return this._room.getParticipants()
.filter((p) => p.getTracks().length > 0)
var foundParticipants = 0; .length;
for (var i = 0; i < participants.length; i += 1) {
if (participants[i].getTracks().length > 0) {
foundParticipants++;
}
}
return foundParticipants >= number;
}, },
/** /**
* Returns the stats. * Returns the stats.