Kaynağa Gözat

feat(conference): add way to check if local participant is hidden

master
Leonard Kim 6 yıl önce
ebeveyn
işleme
985a0bbfab
4 değiştirilmiş dosya ile 38 ekleme ve 0 silme
  1. 18
    0
      JitsiConference.js
  2. 9
    0
      JitsiConnection.js
  3. 2
    0
      doc/API.md
  4. 9
    0
      modules/xmpp/xmpp.js

+ 18
- 0
JitsiConference.js Dosyayı Görüntüle

@@ -1054,6 +1054,22 @@ JitsiConference.prototype.getRole = function() {
1054 1054
     return this.room.role;
1055 1055
 };
1056 1056
 
1057
+/**
1058
+ * Returns whether or not the current conference has been joined as a hidden
1059
+ * user.
1060
+ *
1061
+ * @returns {boolean|null} True if hidden, false otherwise. Will return null if
1062
+ * no connection is active.
1063
+ */
1064
+JitsiConference.prototype.isHidden = function() {
1065
+    if (!this.connection) {
1066
+        return null;
1067
+    }
1068
+
1069
+    return Strophe.getDomainFromJid(this.connection.getJid())
1070
+        === this.options.config.hiddenDomain;
1071
+};
1072
+
1057 1073
 /**
1058 1074
  * Check if local user is moderator.
1059 1075
  * @returns {boolean|null} true if local user is moderator, false otherwise. If
@@ -1312,6 +1328,7 @@ JitsiConference.prototype.onMemberJoined = function(
1312 1328
     if (id === 'focus' || this.myUserId() === id) {
1313 1329
         return;
1314 1330
     }
1331
+
1315 1332
     const participant
1316 1333
         = new JitsiParticipant(jid, this, nick, isHidden, statsID, status);
1317 1334
 
@@ -1373,6 +1390,7 @@ JitsiConference.prototype.onMemberLeft = function(jid) {
1373 1390
     if (id === 'focus' || this.myUserId() === id) {
1374 1391
         return;
1375 1392
     }
1393
+
1376 1394
     const participant = this.participants[id];
1377 1395
 
1378 1396
     delete this.participants[id];

+ 9
- 0
JitsiConnection.js Dosyayı Görüntüle

@@ -84,6 +84,15 @@ JitsiConnection.prototype.disconnect = function(...args) {
84 84
     return this.xmpp.disconnect(...args);
85 85
 };
86 86
 
87
+/**
88
+ * Returns the jid of the participant associated with the XMPP connection.
89
+ *
90
+ * @returns {string} The jid of the participant.
91
+ */
92
+JitsiConnection.prototype.getJid = function() {
93
+    return this.xmpp.getJid();
94
+};
95
+
87 96
 /**
88 97
  * This method allows renewal of the tokens if they are expiring.
89 98
  * @param token the new token.

+ 2
- 0
doc/API.md Dosyayı Görüntüle

@@ -386,6 +386,8 @@ Throws NetworkError or InvalidStateError or Error if the operation fails.
386 386
 34. setReceiverVideoConstraint(resolution) - set the desired resolution to get from JVB (180, 360, 720, 1080, etc).
387 387
     You should use that method if you are using simulcast.
388 388
 
389
+35. isHidden - checks if local user has joined as a "hidden" user. This is a specialized role used for integrations.
390
+
389 391
 JitsiTrack
390 392
 ======
391 393
 The object represents single track - video or audio. They can be remote tracks ( from the other participants in the call) or local tracks (from the devices of the local participant).

+ 9
- 0
modules/xmpp/xmpp.js Dosyayı Görüntüle

@@ -426,6 +426,15 @@ export default class XMPP extends Listenable {
426 426
         return this.connection.emuc.createRoom(roomjid, null, options);
427 427
     }
428 428
 
429
+    /**
430
+     * Returns the jid of the participant associated with the Strophe connection.
431
+     *
432
+     * @returns {string} The jid of the participant.
433
+     */
434
+    getJid() {
435
+        return this.connection.jid;
436
+    }
437
+
429 438
     /**
430 439
      * Returns the logs from strophe.jingle.
431 440
      * @returns {Object}

Loading…
İptal
Kaydet