Adds utility to check for remote participants with tracks.

This commit is contained in:
damencho 2016-01-14 13:50:10 -06:00
parent ea24c6a66a
commit 765f07109a
1 changed files with 19 additions and 0 deletions

View File

@ -230,6 +230,7 @@ export default {
get startVideoMuted () { get startVideoMuted () {
return room && room.getStartMutedPolicy().video; return room && room.getStartMutedPolicy().video;
}, },
// used by torture currently // used by torture currently
isJoined () { isJoined () {
return this._room return this._room
@ -243,6 +244,24 @@ export default {
return this._room return this._room
&& this._room.myUserId(); && this._room.myUserId();
}, },
/**
* Will check for number of remote particiapnts that have at least one
* remote track.
* @return boolean whether we have enough participants with remote streams
*/
checkEnoughParticipants (number) {
var participants = this._room.getParticipants();
var foundParticipants = 0;
for (var i = 0; i < participants.length; i += 1) {
if (participants[i].getTracks().length > 0) {
foundParticipants++;
}
}
return foundParticipants >= number;
},
// end used by torture
_createRoom () { _createRoom () {
room = connection.initJitsiConference(APP.conference.roomName, room = connection.initJitsiConference(APP.conference.roomName,
this._getConferenceOptions()); this._getConferenceOptions());