feat(external-api) expose breakout rooms actions

This commit is contained in:
Mihaela Dumitru 2022-02-04 12:51:33 +02:00 committed by GitHub
parent 66b4c0cab0
commit 01ab415941
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 74 additions and 0 deletions

View File

@ -43,6 +43,15 @@ import {
} from '../../react/features/base/participants'; } from '../../react/features/base/participants';
import { updateSettings } from '../../react/features/base/settings'; import { updateSettings } from '../../react/features/base/settings';
import { isToggleCameraEnabled, toggleCamera } from '../../react/features/base/tracks'; import { isToggleCameraEnabled, toggleCamera } from '../../react/features/base/tracks';
import {
autoAssignToBreakoutRooms,
closeBreakoutRoom,
createBreakoutRoom,
moveToRoom,
removeBreakoutRoom,
sendParticipantToRoom
} from '../../react/features/breakout-rooms/actions';
import { getBreakoutRooms } from '../../react/features/breakout-rooms/functions';
import { import {
sendMessage, sendMessage,
setPrivateMessageRecipient, setPrivateMessageRecipient,
@ -118,6 +127,14 @@ let videoAvailable = true;
*/ */
function initCommands() { function initCommands() {
commands = { commands = {
'add-breakout-room': name => {
if (!isLocalParticipantModerator(APP.store.getState())) {
logger.error('Missing moderator rights to add breakout rooms');
return;
}
APP.store.dispatch(createBreakoutRoom(name));
},
'answer-knocking-participant': (id, approved) => { 'answer-knocking-participant': (id, approved) => {
APP.store.dispatch(setKnockingParticipantApproval(id, approved)); APP.store.dispatch(setKnockingParticipantApproval(id, approved));
}, },
@ -135,6 +152,14 @@ function initCommands() {
APP.store.dispatch(approveParticipantAudio(participantId)); APP.store.dispatch(approveParticipantAudio(participantId));
}, },
'auto-assign-to-breakout-rooms': () => {
if (!isLocalParticipantModerator(APP.store.getState())) {
logger.error('Missing moderator rights to auto-assign participants to breakout rooms');
return;
}
APP.store.dispatch(autoAssignToBreakoutRooms());
},
'display-name': displayName => { 'display-name': displayName => {
sendAnalytics(createApiEvent('display.name.changed')); sendAnalytics(createApiEvent('display.name.changed'));
APP.conference.changeLocalDisplayName(displayName); APP.conference.changeLocalDisplayName(displayName);
@ -198,6 +223,14 @@ function initCommands() {
APP.store.dispatch(reject(participantId)); APP.store.dispatch(reject(participantId));
}, },
'remove-breakout-room': breakoutRoomJid => {
if (!isLocalParticipantModerator(APP.store.getState())) {
logger.error('Missing moderator rights to remove breakout rooms');
return;
}
APP.store.dispatch(removeBreakoutRoom(breakoutRoomJid));
},
'resize-large-video': (width, height) => { 'resize-large-video': (width, height) => {
logger.debug('Resize large video command received'); logger.debug('Resize large video command received');
sendAnalytics(createApiEvent('largevideo.resized')); sendAnalytics(createApiEvent('largevideo.resized'));
@ -537,6 +570,26 @@ function initCommands() {
'cancel-private-chat': () => { 'cancel-private-chat': () => {
APP.store.dispatch(setPrivateMessageRecipient()); APP.store.dispatch(setPrivateMessageRecipient());
}, },
'close-breakout-room': roomId => {
if (!isLocalParticipantModerator(APP.store.getState())) {
logger.error('Missing moderator rights to close breakout rooms');
return;
}
APP.store.dispatch(closeBreakoutRoom(roomId));
},
'join-breakout-room': roomId => {
APP.store.dispatch(moveToRoom(roomId));
},
'send-participant-to-room': (participantId, roomId) => {
if (!isLocalParticipantModerator(APP.store.getState())) {
logger.error('Missing moderator rights to send participants to rooms');
return;
}
APP.store.dispatch(sendParticipantToRoom(participantId, roomId));
},
'kick-participant': participantId => { 'kick-participant': participantId => {
APP.store.dispatch(kickParticipant(participantId)); APP.store.dispatch(kickParticipant(participantId));
}, },
@ -681,6 +734,10 @@ function initCommands() {
}); });
break; break;
} }
case 'list-breakout-rooms': {
callback(getBreakoutRooms(APP.store.getState()));
break;
}
default: default:
return false; return false;
} }

View File

@ -27,17 +27,21 @@ const ALWAYS_ON_TOP_FILENAMES = [
* commands expected by jitsi-meet. * commands expected by jitsi-meet.
*/ */
const commands = { const commands = {
addBreakoutRoom: 'add-breakout-room',
answerKnockingParticipant: 'answer-knocking-participant', answerKnockingParticipant: 'answer-knocking-participant',
approveVideo: 'approve-video', approveVideo: 'approve-video',
askToUnmute: 'ask-to-unmute', askToUnmute: 'ask-to-unmute',
autoAssignToBreakoutRooms: 'auto-assign-to-breakout-rooms',
avatarUrl: 'avatar-url', avatarUrl: 'avatar-url',
cancelPrivateChat: 'cancel-private-chat', cancelPrivateChat: 'cancel-private-chat',
closeBreakoutRoom: 'close-breakout-room',
displayName: 'display-name', displayName: 'display-name',
e2eeKey: 'e2ee-key', e2eeKey: 'e2ee-key',
email: 'email', email: 'email',
toggleLobby: 'toggle-lobby', toggleLobby: 'toggle-lobby',
hangup: 'video-hangup', hangup: 'video-hangup',
initiatePrivateChat: 'initiate-private-chat', initiatePrivateChat: 'initiate-private-chat',
joinBreakoutRoom: 'join-breakout-room',
localSubject: 'local-subject', localSubject: 'local-subject',
kickParticipant: 'kick-participant', kickParticipant: 'kick-participant',
muteEveryone: 'mute-everyone', muteEveryone: 'mute-everyone',
@ -45,9 +49,11 @@ const commands = {
password: 'password', password: 'password',
pinParticipant: 'pin-participant', pinParticipant: 'pin-participant',
rejectParticipant: 'reject-participant', rejectParticipant: 'reject-participant',
removeBreakoutRoom: 'remove-breakout-room',
resizeLargeVideo: 'resize-large-video', resizeLargeVideo: 'resize-large-video',
sendChatMessage: 'send-chat-message', sendChatMessage: 'send-chat-message',
sendEndpointTextMessage: 'send-endpoint-text-message', sendEndpointTextMessage: 'send-endpoint-text-message',
sendParticipantToRoom: 'send-participant-to-room',
sendTones: 'send-tones', sendTones: 'send-tones',
setFollowMe: 'set-follow-me', setFollowMe: 'set-follow-me',
setLargeVideoParticipant: 'set-large-video-participant', setLargeVideoParticipant: 'set-large-video-participant',
@ -1041,6 +1047,17 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
}); });
} }
/**
* Returns the list of breakout rooms.
*
* @returns {Promise} Resolves with the list of breakout rooms.
*/
listBreakoutRooms() {
return this._transport.sendRequest({
name: 'list-breakout-rooms'
});
}
/** /**
* Pins a participant's video on to the stage view. * Pins a participant's video on to the stage view.
* *