瀏覽代碼

feat(API): add dominant speaker changed event

Fixes: https://github.com/jitsi/jitsi-meet/issues/4049
master
Karthik Muralidharan 5 年之前
父節點
當前提交
b658f20a30
共有 4 個檔案被更改,包括 35 行新增2 行删除
  1. 7
    0
      doc/api.md
  2. 14
    0
      modules/API/API.js
  3. 9
    2
      modules/API/external/external_api.js
  4. 5
    0
      react/features/external-api/middleware.js

+ 7
- 0
doc/api.md 查看文件

@@ -322,6 +322,13 @@ changes. The listener will receive an object with the following structure:
322 322
 }
323 323
 ```
324 324
 
325
+* **dominantSpeakerChanged** - receives event notifications about change in the dominant speaker. The listener will receive object with the following structure:
326
+```javascript
327
+{
328
+    id: string //participantId of the new dominant speaker
329
+}
330
+```
331
+
325 332
 * **tileViewChanged** - event notifications about tile view layout mode being entered or exited. The listener will receive object with the following structure:
326 333
 ```javascript
327 334
 {

+ 14
- 0
modules/API/API.js 查看文件

@@ -709,6 +709,20 @@ class API {
709 709
         });
710 710
     }
711 711
 
712
+    /**
713
+     * Notify external application (if API is enabled) that the dominant speaker
714
+     * has been turned on/off.
715
+     *
716
+     * @param {string} id - Id of the dominant participant.
717
+     * @returns {void}
718
+     */
719
+    notifyDominantSpeakerChanged(id: string) {
720
+        this._sendEvent({
721
+            name: 'dominant-speaker-changed',
722
+            id
723
+        });
724
+    }
725
+
712 726
     /**
713 727
      * Notify external application (if API is enabled) that the conference
714 728
      * changed their subject.

+ 9
- 2
modules/API/external/external_api.js 查看文件

@@ -73,6 +73,7 @@ const events = {
73 73
     'video-availability-changed': 'videoAvailabilityChanged',
74 74
     'video-mute-status-changed': 'videoMuteStatusChanged',
75 75
     'screen-sharing-status-changed': 'screenSharingStatusChanged',
76
+    'dominant-speaker-changed': 'dominantSpeakerChanged',
76 77
     'subject-change': 'subjectChange',
77 78
     'suspend-detected': 'suspendDetected',
78 79
     'tile-view-changed': 'tileViewChanged'
@@ -521,13 +522,13 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
521 522
      * {{
522 523
      * jid: jid //the jid of the participant
523 524
      * }}
524
-     * {@code video-conference-joined} - receives event notifications about the
525
+     * {@code videoConferenceJoined} - receives event notifications about the
525 526
      * local user has successfully joined the video conference.
526 527
      * The listener will receive object with the following structure:
527 528
      * {{
528 529
      * roomName: room //the room name of the conference
529 530
      * }}
530
-     * {@code video-conference-left} - receives event notifications about the
531
+     * {@code videoConferenceLeft} - receives event notifications about the
531 532
      * local user has left the video conference.
532 533
      * The listener will receive object with the following structure:
533 534
      * {{
@@ -539,6 +540,12 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
539 540
      * {{
540 541
      * on: on //whether screen sharing is on
541 542
      * }}
543
+     * {@code dominantSpeakerChanged} - receives event notifications about
544
+     * change in the dominant speaker.
545
+     * The listener will receive object with the following structure:
546
+     * {{
547
+     * id: participantId //participantId of the new dominant speaker
548
+     * }}
542 549
      * {@code suspendDetected} - receives event notifications about detecting suspend event in host computer.
543 550
      * {@code readyToClose} - all hangup operations are completed and Jitsi Meet
544 551
      * is ready to be disposed.

+ 5
- 0
react/features/external-api/middleware.js 查看文件

@@ -8,6 +8,7 @@ import {
8 8
 import { NOTIFY_CAMERA_ERROR, NOTIFY_MIC_ERROR } from '../base/devices';
9 9
 import { JitsiConferenceErrors } from '../base/lib-jitsi-meet';
10 10
 import {
11
+    DOMINANT_SPEAKER_CHANGED,
11 12
     PARTICIPANT_KICKED,
12 13
     PARTICIPANT_LEFT,
13 14
     PARTICIPANT_JOINED,
@@ -99,6 +100,10 @@ MiddlewareRegistry.register(store => next => action => {
99 100
         break;
100 101
     }
101 102
 
103
+    case DOMINANT_SPEAKER_CHANGED:
104
+        APP.API.notifyDominantSpeakerChanged(action.participant.id);
105
+        break;
106
+
102 107
     case KICKED_OUT:
103 108
         APP.API.notifyKickedOut(
104 109
             {

Loading…
取消
儲存