Selaa lähdekoodia

Merge pull request #617 from bgrozev/refactor-util

Exposes the number of participants with tracks.
master
George Politis 9 vuotta sitten
vanhempi
commit
7bb20bb967
1 muutettua tiedostoa jossa 6 lisäystä ja 13 poistoa
  1. 6
    13
      conference.js

+ 6
- 13
conference.js Näytä tiedosto

@@ -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.

Loading…
Peruuta
Tallenna