瀏覽代碼

feat(external-api): add knocking event and approve/reject command (#10210)

master
Mihaela Dumitru 4 年之前
父節點
當前提交
f435fc4ade
沒有連結到貢獻者的電子郵件帳戶。
共有 3 個檔案被更改,包括 27 行新增1 行删除
  1. 17
    1
      modules/API/API.js
  2. 2
    0
      modules/API/external/external_api.js
  3. 8
    0
      react/features/lobby/middleware.js

+ 17
- 1
modules/API/API.js 查看文件

61
     captureLargeVideoScreenshot,
61
     captureLargeVideoScreenshot,
62
     resizeLargeVideo
62
     resizeLargeVideo
63
 } from '../../react/features/large-video/actions.web';
63
 } from '../../react/features/large-video/actions.web';
64
-import { toggleLobbyMode } from '../../react/features/lobby/actions';
64
+import { toggleLobbyMode, setKnockingParticipantApproval } from '../../react/features/lobby/actions';
65
 import { isForceMuted } from '../../react/features/participants-pane/functions';
65
 import { isForceMuted } from '../../react/features/participants-pane/functions';
66
 import { RECORDING_TYPES } from '../../react/features/recording/constants';
66
 import { RECORDING_TYPES } from '../../react/features/recording/constants';
67
 import { getActiveSession } from '../../react/features/recording/functions';
67
 import { getActiveSession } from '../../react/features/recording/functions';
113
  */
113
  */
114
 function initCommands() {
114
 function initCommands() {
115
     commands = {
115
     commands = {
116
+        'answer-knocking-participant': (id, approved) => {
117
+            APP.store.dispatch(setKnockingParticipantApproval(id, approved));
118
+        },
116
         'approve-video': participantId => {
119
         'approve-video': participantId => {
117
             if (!isLocalParticipantModerator(APP.store.getState())) {
120
             if (!isLocalParticipantModerator(APP.store.getState())) {
118
                 return;
121
                 return;
1458
         });
1461
         });
1459
     }
1462
     }
1460
 
1463
 
1464
+    /**
1465
+     * Notify external application (if API is enabled) that a participant is knocking in the lobby.
1466
+     *
1467
+     * @param {Object} participant - Participant data such as id and name.
1468
+     * @returns {void}
1469
+     */
1470
+    notifyKnockingParticipant(participant: Object) {
1471
+        this._sendEvent({
1472
+            name: 'knocking-participant',
1473
+            participant
1474
+        });
1475
+    }
1476
+
1461
     /**
1477
     /**
1462
      * Notify external application (if API is enabled) that an error occured.
1478
      * Notify external application (if API is enabled) that an error occured.
1463
      *
1479
      *

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

27
  * commands expected by jitsi-meet
27
  * commands expected by jitsi-meet
28
  */
28
  */
29
 const commands = {
29
 const commands = {
30
+    answerKnockingParticipant: 'answer-knocking-participant',
30
     approveVideo: 'approve-video',
31
     approveVideo: 'approve-video',
31
     askToUnmute: 'ask-to-unmute',
32
     askToUnmute: 'ask-to-unmute',
32
     avatarUrl: 'avatar-url',
33
     avatarUrl: 'avatar-url',
94
     'feedback-prompt-displayed': 'feedbackPromptDisplayed',
95
     'feedback-prompt-displayed': 'feedbackPromptDisplayed',
95
     'filmstrip-display-changed': 'filmstripDisplayChanged',
96
     'filmstrip-display-changed': 'filmstripDisplayChanged',
96
     'incoming-message': 'incomingMessage',
97
     'incoming-message': 'incomingMessage',
98
+    'knocking-participant': 'knockingParticipant',
97
     'log': 'log',
99
     'log': 'log',
98
     'mic-error': 'micError',
100
     'mic-error': 'micError',
99
     'moderation-participant-approved': 'moderationParticipantApproved',
101
     'moderation-participant-approved': 'moderationParticipantApproved',

+ 8
- 0
react/features/lobby/middleware.js 查看文件

25
 import { KNOCKING_PARTICIPANT_SOUND_ID } from './constants';
25
 import { KNOCKING_PARTICIPANT_SOUND_ID } from './constants';
26
 import { KNOCKING_PARTICIPANT_FILE } from './sounds';
26
 import { KNOCKING_PARTICIPANT_FILE } from './sounds';
27
 
27
 
28
+declare var APP: Object;
29
+
28
 MiddlewareRegistry.register(store => next => action => {
30
 MiddlewareRegistry.register(store => next => action => {
29
     switch (action.type) {
31
     switch (action.type) {
30
     case APP_WILL_MOUNT:
32
     case APP_WILL_MOUNT:
69
                         name
71
                         name
70
                     }));
72
                     }));
71
                     dispatch(playSound(KNOCKING_PARTICIPANT_SOUND_ID));
73
                     dispatch(playSound(KNOCKING_PARTICIPANT_SOUND_ID));
74
+                    if (typeof APP !== 'undefined') {
75
+                        APP.API.notifyKnockingParticipant({
76
+                            id,
77
+                            name
78
+                        });
79
+                    }
72
                 });
80
                 });
73
             });
81
             });
74
 
82
 

Loading…
取消
儲存