Przeglądaj źródła

feat: Adds a getParticipantCount function to JitsiConference.

dev1
Boris Grozev 9 lat temu
rodzic
commit
0bd24676ca
1 zmienionych plików z 17 dodań i 0 usunięć
  1. 17
    0
      JitsiConference.js

+ 17
- 0
JitsiConference.js Wyświetl plik

@@ -654,6 +654,23 @@ JitsiConference.prototype.getParticipants = function() {
654 654
     }, this);
655 655
 };
656 656
 
657
+/**
658
+ * Returns the number of participants in the conference, including the local
659
+ * participant.
660
+ * @param countHidden {boolean} Whether or not to include hidden participants
661
+ * in the count. Default: false.
662
+ **/
663
+JitsiConference.prototype.getParticipantCount
664
+    = function(countHidden = false) {
665
+
666
+    let participants = this.getParticipants();
667
+    if (!countHidden) {
668
+        participants = participants.filter(p => !p.isHidden());
669
+    }
670
+    // Add one for the local participant.
671
+    return participants.length + 1;
672
+};
673
+
657 674
 /**
658 675
  * @returns {JitsiParticipant} the participant in this conference with the
659 676
  * specified id (or undefined if there isn't one).

Ładowanie…
Anuluj
Zapisz