feat(external-api): add knocking event and approve/reject command (#10210)
This commit is contained in:
parent
b250f21f91
commit
f435fc4ade
|
@ -61,7 +61,7 @@ import {
|
||||||
captureLargeVideoScreenshot,
|
captureLargeVideoScreenshot,
|
||||||
resizeLargeVideo
|
resizeLargeVideo
|
||||||
} from '../../react/features/large-video/actions.web';
|
} from '../../react/features/large-video/actions.web';
|
||||||
import { toggleLobbyMode } from '../../react/features/lobby/actions';
|
import { toggleLobbyMode, setKnockingParticipantApproval } from '../../react/features/lobby/actions';
|
||||||
import { isForceMuted } from '../../react/features/participants-pane/functions';
|
import { isForceMuted } from '../../react/features/participants-pane/functions';
|
||||||
import { RECORDING_TYPES } from '../../react/features/recording/constants';
|
import { RECORDING_TYPES } from '../../react/features/recording/constants';
|
||||||
import { getActiveSession } from '../../react/features/recording/functions';
|
import { getActiveSession } from '../../react/features/recording/functions';
|
||||||
|
@ -113,6 +113,9 @@ let videoAvailable = true;
|
||||||
*/
|
*/
|
||||||
function initCommands() {
|
function initCommands() {
|
||||||
commands = {
|
commands = {
|
||||||
|
'answer-knocking-participant': (id, approved) => {
|
||||||
|
APP.store.dispatch(setKnockingParticipantApproval(id, approved));
|
||||||
|
},
|
||||||
'approve-video': participantId => {
|
'approve-video': participantId => {
|
||||||
if (!isLocalParticipantModerator(APP.store.getState())) {
|
if (!isLocalParticipantModerator(APP.store.getState())) {
|
||||||
return;
|
return;
|
||||||
|
@ -1458,6 +1461,19 @@ class API {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify external application (if API is enabled) that a participant is knocking in the lobby.
|
||||||
|
*
|
||||||
|
* @param {Object} participant - Participant data such as id and name.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
notifyKnockingParticipant(participant: Object) {
|
||||||
|
this._sendEvent({
|
||||||
|
name: 'knocking-participant',
|
||||||
|
participant
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify external application (if API is enabled) that an error occured.
|
* Notify external application (if API is enabled) that an error occured.
|
||||||
*
|
*
|
||||||
|
|
|
@ -27,6 +27,7 @@ const ALWAYS_ON_TOP_FILENAMES = [
|
||||||
* commands expected by jitsi-meet
|
* commands expected by jitsi-meet
|
||||||
*/
|
*/
|
||||||
const commands = {
|
const commands = {
|
||||||
|
answerKnockingParticipant: 'answer-knocking-participant',
|
||||||
approveVideo: 'approve-video',
|
approveVideo: 'approve-video',
|
||||||
askToUnmute: 'ask-to-unmute',
|
askToUnmute: 'ask-to-unmute',
|
||||||
avatarUrl: 'avatar-url',
|
avatarUrl: 'avatar-url',
|
||||||
|
@ -94,6 +95,7 @@ const events = {
|
||||||
'feedback-prompt-displayed': 'feedbackPromptDisplayed',
|
'feedback-prompt-displayed': 'feedbackPromptDisplayed',
|
||||||
'filmstrip-display-changed': 'filmstripDisplayChanged',
|
'filmstrip-display-changed': 'filmstripDisplayChanged',
|
||||||
'incoming-message': 'incomingMessage',
|
'incoming-message': 'incomingMessage',
|
||||||
|
'knocking-participant': 'knockingParticipant',
|
||||||
'log': 'log',
|
'log': 'log',
|
||||||
'mic-error': 'micError',
|
'mic-error': 'micError',
|
||||||
'moderation-participant-approved': 'moderationParticipantApproved',
|
'moderation-participant-approved': 'moderationParticipantApproved',
|
||||||
|
|
|
@ -25,6 +25,8 @@ import {
|
||||||
import { KNOCKING_PARTICIPANT_SOUND_ID } from './constants';
|
import { KNOCKING_PARTICIPANT_SOUND_ID } from './constants';
|
||||||
import { KNOCKING_PARTICIPANT_FILE } from './sounds';
|
import { KNOCKING_PARTICIPANT_FILE } from './sounds';
|
||||||
|
|
||||||
|
declare var APP: Object;
|
||||||
|
|
||||||
MiddlewareRegistry.register(store => next => action => {
|
MiddlewareRegistry.register(store => next => action => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case APP_WILL_MOUNT:
|
case APP_WILL_MOUNT:
|
||||||
|
@ -69,6 +71,12 @@ StateListenerRegistry.register(
|
||||||
name
|
name
|
||||||
}));
|
}));
|
||||||
dispatch(playSound(KNOCKING_PARTICIPANT_SOUND_ID));
|
dispatch(playSound(KNOCKING_PARTICIPANT_SOUND_ID));
|
||||||
|
if (typeof APP !== 'undefined') {
|
||||||
|
APP.API.notifyKnockingParticipant({
|
||||||
|
id,
|
||||||
|
name
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue