Browse Source

feat(external-api) expose breakout rooms actions

master
Mihaela Dumitru 3 years ago
parent
commit
01ab415941
No account linked to committer's email address
2 changed files with 74 additions and 0 deletions
  1. 57
    0
      modules/API/API.js
  2. 17
    0
      modules/API/external/external_api.js

+ 57
- 0
modules/API/API.js View File

@@ -43,6 +43,15 @@ import {
43 43
 } from '../../react/features/base/participants';
44 44
 import { updateSettings } from '../../react/features/base/settings';
45 45
 import { isToggleCameraEnabled, toggleCamera } from '../../react/features/base/tracks';
46
+import {
47
+    autoAssignToBreakoutRooms,
48
+    closeBreakoutRoom,
49
+    createBreakoutRoom,
50
+    moveToRoom,
51
+    removeBreakoutRoom,
52
+    sendParticipantToRoom
53
+} from '../../react/features/breakout-rooms/actions';
54
+import { getBreakoutRooms } from '../../react/features/breakout-rooms/functions';
46 55
 import {
47 56
     sendMessage,
48 57
     setPrivateMessageRecipient,
@@ -118,6 +127,14 @@ let videoAvailable = true;
118 127
  */
119 128
 function initCommands() {
120 129
     commands = {
130
+        'add-breakout-room': name => {
131
+            if (!isLocalParticipantModerator(APP.store.getState())) {
132
+                logger.error('Missing moderator rights to add breakout rooms');
133
+
134
+                return;
135
+            }
136
+            APP.store.dispatch(createBreakoutRoom(name));
137
+        },
121 138
         'answer-knocking-participant': (id, approved) => {
122 139
             APP.store.dispatch(setKnockingParticipantApproval(id, approved));
123 140
         },
@@ -135,6 +152,14 @@ function initCommands() {
135 152
 
136 153
             APP.store.dispatch(approveParticipantAudio(participantId));
137 154
         },
155
+        'auto-assign-to-breakout-rooms': () => {
156
+            if (!isLocalParticipantModerator(APP.store.getState())) {
157
+                logger.error('Missing moderator rights to auto-assign participants to breakout rooms');
158
+
159
+                return;
160
+            }
161
+            APP.store.dispatch(autoAssignToBreakoutRooms());
162
+        },
138 163
         'display-name': displayName => {
139 164
             sendAnalytics(createApiEvent('display.name.changed'));
140 165
             APP.conference.changeLocalDisplayName(displayName);
@@ -198,6 +223,14 @@ function initCommands() {
198 223
 
199 224
             APP.store.dispatch(reject(participantId));
200 225
         },
226
+        'remove-breakout-room': breakoutRoomJid => {
227
+            if (!isLocalParticipantModerator(APP.store.getState())) {
228
+                logger.error('Missing moderator rights to remove breakout rooms');
229
+
230
+                return;
231
+            }
232
+            APP.store.dispatch(removeBreakoutRoom(breakoutRoomJid));
233
+        },
201 234
         'resize-large-video': (width, height) => {
202 235
             logger.debug('Resize large video command received');
203 236
             sendAnalytics(createApiEvent('largevideo.resized'));
@@ -537,6 +570,26 @@ function initCommands() {
537 570
         'cancel-private-chat': () => {
538 571
             APP.store.dispatch(setPrivateMessageRecipient());
539 572
         },
573
+        'close-breakout-room': roomId => {
574
+            if (!isLocalParticipantModerator(APP.store.getState())) {
575
+                logger.error('Missing moderator rights to close breakout rooms');
576
+
577
+                return;
578
+            }
579
+            APP.store.dispatch(closeBreakoutRoom(roomId));
580
+        },
581
+        'join-breakout-room': roomId => {
582
+            APP.store.dispatch(moveToRoom(roomId));
583
+        },
584
+        'send-participant-to-room': (participantId, roomId) => {
585
+            if (!isLocalParticipantModerator(APP.store.getState())) {
586
+                logger.error('Missing moderator rights to send participants to rooms');
587
+
588
+                return;
589
+            }
590
+
591
+            APP.store.dispatch(sendParticipantToRoom(participantId, roomId));
592
+        },
540 593
         'kick-participant': participantId => {
541 594
             APP.store.dispatch(kickParticipant(participantId));
542 595
         },
@@ -681,6 +734,10 @@ function initCommands() {
681 734
             });
682 735
             break;
683 736
         }
737
+        case 'list-breakout-rooms': {
738
+            callback(getBreakoutRooms(APP.store.getState()));
739
+            break;
740
+        }
684 741
         default:
685 742
             return false;
686 743
         }

+ 17
- 0
modules/API/external/external_api.js View File

@@ -27,17 +27,21 @@ const ALWAYS_ON_TOP_FILENAMES = [
27 27
  * commands expected by jitsi-meet.
28 28
  */
29 29
 const commands = {
30
+    addBreakoutRoom: 'add-breakout-room',
30 31
     answerKnockingParticipant: 'answer-knocking-participant',
31 32
     approveVideo: 'approve-video',
32 33
     askToUnmute: 'ask-to-unmute',
34
+    autoAssignToBreakoutRooms: 'auto-assign-to-breakout-rooms',
33 35
     avatarUrl: 'avatar-url',
34 36
     cancelPrivateChat: 'cancel-private-chat',
37
+    closeBreakoutRoom: 'close-breakout-room',
35 38
     displayName: 'display-name',
36 39
     e2eeKey: 'e2ee-key',
37 40
     email: 'email',
38 41
     toggleLobby: 'toggle-lobby',
39 42
     hangup: 'video-hangup',
40 43
     initiatePrivateChat: 'initiate-private-chat',
44
+    joinBreakoutRoom: 'join-breakout-room',
41 45
     localSubject: 'local-subject',
42 46
     kickParticipant: 'kick-participant',
43 47
     muteEveryone: 'mute-everyone',
@@ -45,9 +49,11 @@ const commands = {
45 49
     password: 'password',
46 50
     pinParticipant: 'pin-participant',
47 51
     rejectParticipant: 'reject-participant',
52
+    removeBreakoutRoom: 'remove-breakout-room',
48 53
     resizeLargeVideo: 'resize-large-video',
49 54
     sendChatMessage: 'send-chat-message',
50 55
     sendEndpointTextMessage: 'send-endpoint-text-message',
56
+    sendParticipantToRoom: 'send-participant-to-room',
51 57
     sendTones: 'send-tones',
52 58
     setFollowMe: 'set-follow-me',
53 59
     setLargeVideoParticipant: 'set-large-video-participant',
@@ -1041,6 +1047,17 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
1041 1047
         });
1042 1048
     }
1043 1049
 
1050
+    /**
1051
+     * Returns the list of breakout rooms.
1052
+     *
1053
+     * @returns {Promise} Resolves with the list of breakout rooms.
1054
+     */
1055
+    listBreakoutRooms() {
1056
+        return this._transport.sendRequest({
1057
+            name: 'list-breakout-rooms'
1058
+        });
1059
+    }
1060
+
1044 1061
     /**
1045 1062
      * Pins a participant's video on to the stage view.
1046 1063
      *

Loading…
Cancel
Save