瀏覽代碼

feat(conference) Implement audio/video mute disable when sender limit is reached.

Jicofo sends a presence when the audio/video sender limit is reaced in the conference. The client can then proceed to disable the audio and video mute buttons when this occurs.
dev1
Jaya Allamsetty 3 年之前
父節點
當前提交
b9ac97438f
共有 3 個檔案被更改,包括 49 行新增7 行删除
  1. 30
    3
      JitsiConference.js
  2. 12
    0
      JitsiConferenceEvents.js
  3. 7
    4
      modules/xmpp/ChatRoom.js

+ 30
- 3
JitsiConference.js 查看文件

285
 
285
 
286
         this._e2eEncryption = new E2EEncryption(this);
286
         this._e2eEncryption = new E2EEncryption(this);
287
     }
287
     }
288
+
289
+    /**
290
+     * Flag set to <tt>true</tt> when Jicofo sends a presence message indicating that the max audio sender limit has
291
+     * been reached for the call. Once this is set, unmuting audio will be disabled from the client until it gets reset
292
+     * again by Jicofo.
293
+     */
294
+    this._audioSenderLimitReached = undefined;
295
+
296
+    /**
297
+     * Flag set to <tt>true</tt> when Jicofo sends a presence message indicating that the max video sender limit has
298
+     * been reached for the call. Once this is set, unmuting video will be disabled from the client until it gets reset
299
+     * again by Jicofo.
300
+     */
301
+    this._videoSenderLimitReached = undefined;
288
 }
302
 }
289
 
303
 
290
 // FIXME convert JitsiConference to ES6 - ASAP !
304
 // FIXME convert JitsiConference to ES6 - ASAP !
3151
 
3165
 
3152
     this.properties = properties;
3166
     this.properties = properties;
3153
     if (changed) {
3167
     if (changed) {
3154
-        this.eventEmitter.emit(
3155
-            JitsiConferenceEvents.PROPERTIES_CHANGED,
3156
-            this.properties);
3168
+        this.eventEmitter.emit(JitsiConferenceEvents.PROPERTIES_CHANGED, this.properties);
3169
+
3170
+        const audioLimitReached = this.properties['audio-limit-reached'] === 'true';
3171
+        const videoLimitReached = this.properties['video-limit-reached'] === 'true';
3172
+
3173
+        if (this._audioSenderLimitReached !== audioLimitReached) {
3174
+            this._audioSenderLimitReached = audioLimitReached;
3175
+            this.eventEmitter.emit(JitsiConferenceEvents.AUDIO_UNMUTE_PERMISSIONS_CHANGED, audioLimitReached);
3176
+            logger.info(`Audio unmute permissions set by Jicofo to ${audioLimitReached}`);
3177
+        }
3178
+
3179
+        if (this._videoSenderLimitReached !== videoLimitReached) {
3180
+            this._videoSenderLimitReached = videoLimitReached;
3181
+            this.eventEmitter.emit(JitsiConferenceEvents.VIDEO_UNMUTE_PERMISSIONS_CHANGED, videoLimitReached);
3182
+            logger.info(`Video unmute permissions set by Jicofo to ${videoLimitReached}`);
3183
+        }
3157
 
3184
 
3158
         // Some of the properties need to be added to analytics events.
3185
         // Some of the properties need to be added to analytics events.
3159
         const analyticsKeys = [
3186
         const analyticsKeys = [

+ 12
- 0
JitsiConferenceEvents.js 查看文件

8
  */
8
  */
9
 export const AUDIO_INPUT_STATE_CHANGE = 'conference.audio_input_state_changed';
9
 export const AUDIO_INPUT_STATE_CHANGE = 'conference.audio_input_state_changed';
10
 
10
 
11
+/**
12
+ * Event indicates that the permission for unmuting audio has changed based on the number of audio senders in the call
13
+ * and the audio sender limit configured in Jicofo.
14
+ */
15
+export const AUDIO_UNMUTE_PERMISSIONS_CHANGED = 'conference.audio_unmute_permissions_changed';
16
+
11
 /**
17
 /**
12
  * Indicates that authentication status changed.
18
  * Indicates that authentication status changed.
13
  */
19
  */
362
  */
368
  */
363
 export const USER_STATUS_CHANGED = 'conference.statusChanged';
369
 export const USER_STATUS_CHANGED = 'conference.statusChanged';
364
 
370
 
371
+/**
372
+ * Event indicates that the permission for unmuting video has changed based on the number of video senders in the call
373
+ * and the video sender limit configured in Jicofo.
374
+ */
375
+export const VIDEO_UNMUTE_PERMISSIONS_CHANGED = 'conference.video_unmute_permissions_changed';
376
+
365
 /**
377
 /**
366
  * Event indicates that the bot participant type changed.
378
  * Event indicates that the bot participant type changed.
367
  */
379
  */

+ 7
- 4
modules/xmpp/ChatRoom.js 查看文件

741
                         }
741
                         }
742
                     }
742
                     }
743
 
743
 
744
-                    this.eventEmitter.emit(
745
-                        XMPPEvents.CONFERENCE_PROPERTIES_CHANGED, properties);
744
+                    this.eventEmitter.emit(XMPPEvents.CONFERENCE_PROPERTIES_CHANGED, properties);
746
 
745
 
747
-                    this.restartByTerminateSupported = properties['support-terminate-restart'] === 'true';
748
-                    logger.info(`Jicofo supports restart by terminate: ${this.supportsRestartByTerminate()}`);
746
+                    // Log if Jicofo supports restart by terminate only once. This conference property does not change
747
+                    // during the call.
748
+                    if (typeof this.restartByTerminateSupported === 'undefined') {
749
+                        this.restartByTerminateSupported = properties['support-terminate-restart'] === 'true';
750
+                        logger.info(`Jicofo supports restart by terminate: ${this.supportsRestartByTerminate()}`);
751
+                    }
749
                 }
752
                 }
750
                 break;
753
                 break;
751
             case 'transcription-status': {
754
             case 'transcription-status': {

Loading…
取消
儲存