Просмотр исходного кода

Exposes the number of participants with tracks.

j8
Boris Grozev 9 лет назад
Родитель
Сommit
fb7c2082e6
1 измененных файлов: 6 добавлений и 13 удалений
  1. 6
    13
      conference.js

+ 6
- 13
conference.js Просмотреть файл

@@ -474,20 +474,13 @@ export default {
474 474
         return this.audioLevelsMap[id];
475 475
     },
476 476
     /**
477
-     * Will check for number of remote particiapnts that have at least one
478
-     * remote track.
479
-     * @return {boolean} whether we have enough participants with remote streams
477
+     * @return {number} the number of participants in the conference with at
478
+     * least one track.
480 479
      */
481
-    checkEnoughParticipants (number) {
482
-        var participants = this._room.getParticipants();
483
-
484
-        var foundParticipants = 0;
485
-        for (var i = 0; i < participants.length; i += 1) {
486
-            if (participants[i].getTracks().length > 0) {
487
-                foundParticipants++;
488
-            }
489
-        }
490
-        return foundParticipants >= number;
480
+    getNumberOfParticipantsWithTracks() {
481
+        return this._room.getParticipants()
482
+            .filter((p) => p.getTracks().length > 0)
483
+            .length;
491 484
     },
492 485
     /**
493 486
      * Returns the stats.

Загрузка…
Отмена
Сохранить