2017-10-03 19:24:00 +00:00
|
|
|
// @flow
|
|
|
|
|
2021-11-10 10:11:29 +00:00
|
|
|
import Logger from '@jitsi/logger';
|
2020-05-20 10:57:03 +00:00
|
|
|
|
2017-12-11 18:48:32 +00:00
|
|
|
import {
|
2018-01-03 21:24:07 +00:00
|
|
|
createApiEvent,
|
|
|
|
sendAnalytics
|
2017-12-11 18:48:32 +00:00
|
|
|
} from '../../react/features/analytics';
|
2021-09-29 13:41:23 +00:00
|
|
|
import {
|
|
|
|
approveParticipantAudio,
|
|
|
|
approveParticipantVideo,
|
|
|
|
rejectParticipantAudio,
|
|
|
|
rejectParticipantVideo,
|
|
|
|
requestDisableAudioModeration,
|
|
|
|
requestDisableVideoModeration,
|
|
|
|
requestEnableAudioModeration,
|
|
|
|
requestEnableVideoModeration
|
|
|
|
} from '../../react/features/av-moderation/actions';
|
|
|
|
import { isEnabledFromState } from '../../react/features/av-moderation/functions';
|
2019-08-30 21:17:22 +00:00
|
|
|
import {
|
2022-09-16 12:29:54 +00:00
|
|
|
endConference,
|
2020-05-22 19:24:56 +00:00
|
|
|
getCurrentConference,
|
2019-08-30 21:17:22 +00:00
|
|
|
sendTones,
|
2021-07-06 11:37:31 +00:00
|
|
|
setFollowMe,
|
2021-12-17 07:38:15 +00:00
|
|
|
setLocalSubject,
|
2019-08-30 21:17:22 +00:00
|
|
|
setPassword,
|
|
|
|
setSubject
|
|
|
|
} from '../../react/features/base/conference';
|
2022-09-27 07:10:28 +00:00
|
|
|
import { getWhitelistedJSON, overwriteConfig } from '../../react/features/base/config';
|
2021-05-27 07:57:59 +00:00
|
|
|
import { toggleDialog } from '../../react/features/base/dialog/actions';
|
2021-09-15 12:56:21 +00:00
|
|
|
import { isSupportedBrowser } from '../../react/features/base/environment';
|
2018-05-03 01:20:31 +00:00
|
|
|
import { parseJWTFromURLParams } from '../../react/features/base/jwt';
|
2020-11-03 09:44:41 +00:00
|
|
|
import JitsiMeetJS, { JitsiRecordingConstants } from '../../react/features/base/lib-jitsi-meet';
|
2022-11-01 21:47:49 +00:00
|
|
|
import { MEDIA_TYPE, VIDEO_TYPE } from '../../react/features/base/media';
|
2021-03-22 16:22:45 +00:00
|
|
|
import {
|
2022-09-27 07:10:28 +00:00
|
|
|
LOCAL_PARTICIPANT_DEFAULT_ID,
|
2021-03-22 16:22:45 +00:00
|
|
|
getLocalParticipant,
|
|
|
|
getParticipantById,
|
2022-10-07 14:32:07 +00:00
|
|
|
getScreenshareParticipantIds,
|
2022-11-01 21:47:49 +00:00
|
|
|
getVirtualScreenshareParticipantByOwnerId,
|
2022-05-20 10:45:09 +00:00
|
|
|
grantModerator,
|
2022-09-27 07:10:28 +00:00
|
|
|
hasRaisedHand,
|
|
|
|
isLocalParticipantModerator,
|
|
|
|
isParticipantModerator,
|
|
|
|
kickParticipant,
|
2022-08-30 08:42:29 +00:00
|
|
|
overwriteParticipantsNames,
|
2022-09-27 07:10:28 +00:00
|
|
|
pinParticipant,
|
|
|
|
raiseHand
|
2021-03-22 16:22:45 +00:00
|
|
|
} from '../../react/features/base/participants';
|
2021-03-25 12:57:41 +00:00
|
|
|
import { updateSettings } from '../../react/features/base/settings';
|
2022-08-30 08:42:29 +00:00
|
|
|
import { getDisplayName } from '../../react/features/base/settings/functions.web';
|
2021-03-25 11:48:49 +00:00
|
|
|
import { isToggleCameraEnabled, toggleCamera } from '../../react/features/base/tracks';
|
2022-02-04 10:51:33 +00:00
|
|
|
import {
|
|
|
|
autoAssignToBreakoutRooms,
|
|
|
|
closeBreakoutRoom,
|
|
|
|
createBreakoutRoom,
|
|
|
|
moveToRoom,
|
|
|
|
removeBreakoutRoom,
|
|
|
|
sendParticipantToRoom
|
|
|
|
} from '../../react/features/breakout-rooms/actions';
|
2022-09-06 06:51:38 +00:00
|
|
|
import { getBreakoutRooms, getRoomsInfo } from '../../react/features/breakout-rooms/functions';
|
2021-04-24 13:14:07 +00:00
|
|
|
import {
|
2021-06-24 09:37:26 +00:00
|
|
|
sendMessage,
|
2021-04-24 13:14:07 +00:00
|
|
|
setPrivateMessageRecipient,
|
|
|
|
toggleChat
|
|
|
|
} from '../../react/features/chat/actions';
|
2021-02-12 11:18:16 +00:00
|
|
|
import { openChat } from '../../react/features/chat/actions.web';
|
2020-05-20 10:57:03 +00:00
|
|
|
import {
|
|
|
|
processExternalDeviceRequest
|
|
|
|
} from '../../react/features/device-selection/functions';
|
2022-08-30 08:42:29 +00:00
|
|
|
import { appendSuffix } from '../../react/features/display-name';
|
2020-05-22 19:24:56 +00:00
|
|
|
import { isEnabled as isDropboxEnabled } from '../../react/features/dropbox';
|
2021-11-16 11:12:10 +00:00
|
|
|
import { setMediaEncryptionKey, toggleE2EE } from '../../react/features/e2ee/actions';
|
2023-02-16 13:54:27 +00:00
|
|
|
import {
|
|
|
|
addStageParticipant,
|
|
|
|
resizeFilmStrip,
|
|
|
|
setVolume,
|
|
|
|
togglePinStageParticipant
|
|
|
|
} from '../../react/features/filmstrip/actions.web';
|
|
|
|
import { getPinnedActiveParticipants, isStageFilmstripAvailable } from '../../react/features/filmstrip/functions.web';
|
2018-05-03 01:20:31 +00:00
|
|
|
import { invite } from '../../react/features/invite';
|
2020-09-18 15:53:27 +00:00
|
|
|
import {
|
|
|
|
selectParticipantInLargeVideo
|
2021-06-04 21:09:45 +00:00
|
|
|
} from '../../react/features/large-video/actions.any';
|
|
|
|
import {
|
|
|
|
captureLargeVideoScreenshot,
|
|
|
|
resizeLargeVideo
|
|
|
|
} from '../../react/features/large-video/actions.web';
|
2022-09-27 07:10:28 +00:00
|
|
|
import { answerKnockingParticipant, toggleLobbyMode } from '../../react/features/lobby/actions';
|
2022-08-04 12:47:49 +00:00
|
|
|
import { setNoiseSuppressionEnabled } from '../../react/features/noise-suppression/actions';
|
2022-08-01 10:37:41 +00:00
|
|
|
import {
|
|
|
|
NOTIFICATION_TIMEOUT_TYPE,
|
|
|
|
NOTIFICATION_TYPE,
|
2022-09-27 07:10:28 +00:00
|
|
|
hideNotification,
|
2022-08-01 10:37:41 +00:00
|
|
|
showNotification
|
|
|
|
} from '../../react/features/notifications';
|
2022-02-01 10:45:54 +00:00
|
|
|
import {
|
|
|
|
close as closeParticipantsPane,
|
|
|
|
open as openParticipantsPane
|
|
|
|
} from '../../react/features/participants-pane/actions';
|
|
|
|
import { getParticipantsPaneOpen, isForceMuted } from '../../react/features/participants-pane/functions';
|
2022-09-23 08:46:54 +00:00
|
|
|
import { startLocalVideoRecording, stopLocalVideoRecording } from '../../react/features/recording';
|
2020-05-22 19:24:56 +00:00
|
|
|
import { RECORDING_TYPES } from '../../react/features/recording/constants';
|
2022-09-23 10:22:37 +00:00
|
|
|
import { getActiveSession, supportsLocalRecording } from '../../react/features/recording/functions';
|
2022-09-27 07:10:28 +00:00
|
|
|
import { startAudioScreenShareFlow, startScreenShareFlow } from '../../react/features/screen-share/actions';
|
2022-10-28 10:07:58 +00:00
|
|
|
import { isScreenAudioSupported } from '../../react/features/screen-share/functions';
|
2021-12-08 14:15:59 +00:00
|
|
|
import { toggleScreenshotCaptureSummary } from '../../react/features/screenshot-capture';
|
2022-01-28 09:11:35 +00:00
|
|
|
import { isScreenshotCaptureEnabled } from '../../react/features/screenshot-capture/functions';
|
2021-04-16 09:43:34 +00:00
|
|
|
import { playSharedVideo, stopSharedVideo } from '../../react/features/shared-video/actions.any';
|
2022-01-14 23:35:31 +00:00
|
|
|
import { extractYoutubeIdOrURL } from '../../react/features/shared-video/functions';
|
2022-09-27 07:10:28 +00:00
|
|
|
import { setRequestingSubtitles, toggleRequestingSubtitles } from '../../react/features/subtitles/actions';
|
2022-04-26 12:32:18 +00:00
|
|
|
import { isAudioMuteButtonDisabled } from '../../react/features/toolbox/functions';
|
2022-09-27 07:10:28 +00:00
|
|
|
import { setTileView, toggleTileView } from '../../react/features/video-layout';
|
2021-01-21 20:46:47 +00:00
|
|
|
import { muteAllParticipants } from '../../react/features/video-menu/actions';
|
2020-05-07 18:26:10 +00:00
|
|
|
import { setVideoQuality } from '../../react/features/video-quality';
|
2021-05-27 07:57:59 +00:00
|
|
|
import VirtualBackgroundDialog from '../../react/features/virtual-background/components/VirtualBackgroundDialog';
|
2017-04-28 20:24:20 +00:00
|
|
|
import { getJitsiMeetTransport } from '../transport';
|
2020-05-20 10:57:03 +00:00
|
|
|
|
2020-03-20 11:51:26 +00:00
|
|
|
import { API_ID, ENDPOINT_TEXT_MESSAGE_NAME } from './constants';
|
2016-06-13 21:11:44 +00:00
|
|
|
|
2020-05-20 10:57:03 +00:00
|
|
|
const logger = Logger.getLogger(__filename);
|
2017-10-09 21:40:38 +00:00
|
|
|
|
2017-04-17 15:52:31 +00:00
|
|
|
declare var APP: Object;
|
2017-04-06 22:09:55 +00:00
|
|
|
|
2015-01-09 13:39:32 +00:00
|
|
|
/**
|
|
|
|
* List of the available commands.
|
|
|
|
*/
|
2016-06-13 21:11:44 +00:00
|
|
|
let commands = {};
|
|
|
|
|
|
|
|
/**
|
2017-04-28 20:24:20 +00:00
|
|
|
* The transport instance used for communication with external apps.
|
|
|
|
*
|
|
|
|
* @type {Transport}
|
2016-06-13 21:11:44 +00:00
|
|
|
*/
|
2017-04-28 20:24:20 +00:00
|
|
|
const transport = getJitsiMeetTransport();
|
2017-04-06 22:09:55 +00:00
|
|
|
|
2017-08-04 08:15:11 +00:00
|
|
|
/**
|
|
|
|
* The current audio availability.
|
|
|
|
*
|
|
|
|
* @type {boolean}
|
|
|
|
*/
|
|
|
|
let audioAvailable = true;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The current video availability.
|
|
|
|
*
|
|
|
|
* @type {boolean}
|
|
|
|
*/
|
|
|
|
let videoAvailable = true;
|
|
|
|
|
2017-04-11 18:02:59 +00:00
|
|
|
/**
|
|
|
|
* Initializes supported commands.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2015-07-02 21:33:06 +00:00
|
|
|
function initCommands() {
|
2015-07-28 18:22:11 +00:00
|
|
|
commands = {
|
2022-02-04 10:51:33 +00:00
|
|
|
'add-breakout-room': name => {
|
|
|
|
if (!isLocalParticipantModerator(APP.store.getState())) {
|
|
|
|
logger.error('Missing moderator rights to add breakout rooms');
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
APP.store.dispatch(createBreakoutRoom(name));
|
|
|
|
},
|
2021-10-21 07:39:13 +00:00
|
|
|
'answer-knocking-participant': (id, approved) => {
|
2022-03-01 12:17:06 +00:00
|
|
|
APP.store.dispatch(answerKnockingParticipant(id, approved));
|
2021-10-21 07:39:13 +00:00
|
|
|
},
|
2021-09-29 13:41:23 +00:00
|
|
|
'approve-video': participantId => {
|
|
|
|
if (!isLocalParticipantModerator(APP.store.getState())) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
APP.store.dispatch(approveParticipantVideo(participantId));
|
|
|
|
},
|
|
|
|
'ask-to-unmute': participantId => {
|
|
|
|
if (!isLocalParticipantModerator(APP.store.getState())) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
APP.store.dispatch(approveParticipantAudio(participantId));
|
|
|
|
},
|
2022-02-04 10:51:33 +00:00
|
|
|
'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());
|
|
|
|
},
|
2022-03-23 09:31:44 +00:00
|
|
|
'grant-moderator': participantId => {
|
|
|
|
if (!isLocalParticipantModerator(APP.store.getState())) {
|
|
|
|
logger.error('Missing moderator rights to grant moderator right to another participant');
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
APP.store.dispatch(grantModerator(participantId));
|
|
|
|
},
|
2018-01-03 21:24:07 +00:00
|
|
|
'display-name': displayName => {
|
|
|
|
sendAnalytics(createApiEvent('display.name.changed'));
|
|
|
|
APP.conference.changeLocalDisplayName(displayName);
|
|
|
|
},
|
2021-12-17 07:38:15 +00:00
|
|
|
'local-subject': localSubject => {
|
|
|
|
sendAnalytics(createApiEvent('local.subject.changed'));
|
|
|
|
APP.store.dispatch(setLocalSubject(localSubject));
|
|
|
|
},
|
2021-02-24 21:45:07 +00:00
|
|
|
'mute-everyone': mediaType => {
|
|
|
|
const muteMediaType = mediaType ? mediaType : MEDIA_TYPE.AUDIO;
|
|
|
|
|
2020-05-19 06:50:21 +00:00
|
|
|
sendAnalytics(createApiEvent('muted-everyone'));
|
2021-07-09 12:36:19 +00:00
|
|
|
const localParticipant = getLocalParticipant(APP.store.getState());
|
|
|
|
const exclude = [];
|
2020-05-19 06:50:21 +00:00
|
|
|
|
2021-07-09 12:36:19 +00:00
|
|
|
if (localParticipant && isParticipantModerator(localParticipant)) {
|
|
|
|
exclude.push(localParticipant.id);
|
|
|
|
}
|
|
|
|
|
|
|
|
APP.store.dispatch(muteAllParticipants(exclude, muteMediaType));
|
2020-05-19 06:50:21 +00:00
|
|
|
},
|
2020-07-23 14:03:53 +00:00
|
|
|
'toggle-lobby': isLobbyEnabled => {
|
|
|
|
APP.store.dispatch(toggleLobbyMode(isLobbyEnabled));
|
|
|
|
},
|
2019-06-08 17:35:11 +00:00
|
|
|
'password': password => {
|
|
|
|
const { conference, passwordRequired }
|
|
|
|
= APP.store.getState()['features/base/conference'];
|
|
|
|
|
|
|
|
if (passwordRequired) {
|
|
|
|
sendAnalytics(createApiEvent('submit.password'));
|
|
|
|
|
|
|
|
APP.store.dispatch(setPassword(
|
|
|
|
passwordRequired,
|
|
|
|
passwordRequired.join,
|
|
|
|
password
|
|
|
|
));
|
|
|
|
} else {
|
|
|
|
sendAnalytics(createApiEvent('password.changed'));
|
|
|
|
|
|
|
|
APP.store.dispatch(setPassword(
|
|
|
|
conference,
|
|
|
|
conference.lock,
|
|
|
|
password
|
|
|
|
));
|
|
|
|
}
|
|
|
|
},
|
2022-11-01 21:47:49 +00:00
|
|
|
'pin-participant': (id, videoType) => {
|
2020-09-22 16:25:13 +00:00
|
|
|
logger.debug('Pin participant command received');
|
2022-11-01 21:47:49 +00:00
|
|
|
|
|
|
|
const state = APP.store.getState();
|
2023-02-16 13:54:27 +00:00
|
|
|
|
|
|
|
// if id not provided, unpin everybody.
|
|
|
|
if (!id) {
|
|
|
|
const pinnedParticipants = getPinnedActiveParticipants(state);
|
|
|
|
|
|
|
|
pinnedParticipants?.forEach(p => {
|
|
|
|
APP.store.dispatch(togglePinStageParticipant(p.participantId));
|
|
|
|
});
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-11-01 21:47:49 +00:00
|
|
|
const participant = videoType === VIDEO_TYPE.DESKTOP
|
|
|
|
? getVirtualScreenshareParticipantByOwnerId(state, id) : getParticipantById(state, id);
|
|
|
|
|
|
|
|
if (!participant) {
|
|
|
|
logger.warn('Trying to pin a non-existing participant with pin-participant command.');
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-09-22 16:25:13 +00:00
|
|
|
sendAnalytics(createApiEvent('participant.pinned'));
|
2022-11-01 21:47:49 +00:00
|
|
|
|
|
|
|
const participantId = participant.id;
|
|
|
|
|
2023-02-16 13:54:27 +00:00
|
|
|
if (isStageFilmstripAvailable(state)) {
|
2022-11-01 21:47:49 +00:00
|
|
|
APP.store.dispatch(addStageParticipant(participantId, true));
|
2022-09-26 09:13:32 +00:00
|
|
|
} else {
|
2022-11-01 21:47:49 +00:00
|
|
|
APP.store.dispatch(pinParticipant(participantId));
|
2022-09-26 09:13:32 +00:00
|
|
|
}
|
2020-09-22 16:25:13 +00:00
|
|
|
},
|
2019-01-26 20:53:11 +00:00
|
|
|
'proxy-connection-event': event => {
|
|
|
|
APP.conference.onProxyConnectionEvent(event);
|
|
|
|
},
|
2021-09-29 13:41:23 +00:00
|
|
|
'reject-participant': (participantId, mediaType) => {
|
|
|
|
if (!isLocalParticipantModerator(APP.store.getState())) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const reject = mediaType === MEDIA_TYPE.VIDEO ? rejectParticipantVideo : rejectParticipantAudio;
|
|
|
|
|
|
|
|
APP.store.dispatch(reject(participantId));
|
|
|
|
},
|
2022-02-04 10:51:33 +00:00
|
|
|
'remove-breakout-room': breakoutRoomJid => {
|
|
|
|
if (!isLocalParticipantModerator(APP.store.getState())) {
|
|
|
|
logger.error('Missing moderator rights to remove breakout rooms');
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
APP.store.dispatch(removeBreakoutRoom(breakoutRoomJid));
|
|
|
|
},
|
2020-09-16 23:16:32 +00:00
|
|
|
'resize-large-video': (width, height) => {
|
|
|
|
logger.debug('Resize large video command received');
|
|
|
|
sendAnalytics(createApiEvent('largevideo.resized'));
|
|
|
|
APP.store.dispatch(resizeLargeVideo(width, height));
|
|
|
|
},
|
2019-08-30 21:17:22 +00:00
|
|
|
'send-tones': (options = {}) => {
|
|
|
|
const { duration, tones, pause } = options;
|
|
|
|
|
|
|
|
APP.store.dispatch(sendTones(tones, duration, pause));
|
|
|
|
},
|
2021-07-06 11:37:31 +00:00
|
|
|
'set-follow-me': value => {
|
|
|
|
logger.debug('Set follow me command received');
|
|
|
|
|
|
|
|
if (value) {
|
|
|
|
sendAnalytics(createApiEvent('follow.me.set'));
|
|
|
|
} else {
|
|
|
|
sendAnalytics(createApiEvent('follow.me.unset'));
|
|
|
|
}
|
|
|
|
|
|
|
|
APP.store.dispatch(setFollowMe(value));
|
|
|
|
},
|
2022-11-01 21:47:49 +00:00
|
|
|
'set-large-video-participant': (participantId, videoType) => {
|
2020-09-14 20:01:46 +00:00
|
|
|
logger.debug('Set large video participant command received');
|
2022-11-01 21:47:49 +00:00
|
|
|
|
|
|
|
if (!participantId) {
|
|
|
|
sendAnalytics(createApiEvent('largevideo.participant.set'));
|
|
|
|
APP.store.dispatch(selectParticipantInLargeVideo());
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const state = APP.store.getState();
|
|
|
|
const participant = videoType === VIDEO_TYPE.DESKTOP
|
|
|
|
? getVirtualScreenshareParticipantByOwnerId(state, participantId)
|
|
|
|
: getParticipantById(state, participantId);
|
|
|
|
|
|
|
|
if (!participant) {
|
|
|
|
logger.warn('Trying to select a non-existing participant with set-large-video-participant command.');
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-09-14 21:26:32 +00:00
|
|
|
sendAnalytics(createApiEvent('largevideo.participant.set'));
|
2022-11-01 21:47:49 +00:00
|
|
|
APP.store.dispatch(selectParticipantInLargeVideo(participant.id));
|
2020-09-14 20:01:46 +00:00
|
|
|
},
|
2021-06-02 20:28:39 +00:00
|
|
|
'set-participant-volume': (participantId, volume) => {
|
|
|
|
APP.store.dispatch(setVolume(participantId, volume));
|
|
|
|
},
|
2019-02-17 14:40:24 +00:00
|
|
|
'subject': subject => {
|
|
|
|
sendAnalytics(createApiEvent('subject.changed'));
|
2019-03-12 17:45:53 +00:00
|
|
|
APP.store.dispatch(setSubject(subject));
|
2019-02-17 14:40:24 +00:00
|
|
|
},
|
2018-01-19 22:19:55 +00:00
|
|
|
'submit-feedback': feedback => {
|
|
|
|
sendAnalytics(createApiEvent('submit.feedback'));
|
|
|
|
APP.conference.submitFeedback(feedback.score, feedback.message);
|
|
|
|
},
|
2017-07-25 10:05:08 +00:00
|
|
|
'toggle-audio': () => {
|
2018-01-03 21:24:07 +00:00
|
|
|
sendAnalytics(createApiEvent('toggle-audio'));
|
2017-10-09 21:40:38 +00:00
|
|
|
logger.log('Audio toggle: API command received');
|
2017-07-25 10:05:08 +00:00
|
|
|
APP.conference.toggleAudioMuted(false /* no UI */);
|
|
|
|
},
|
2017-07-20 12:29:15 +00:00
|
|
|
'toggle-video': () => {
|
2018-01-03 21:24:07 +00:00
|
|
|
sendAnalytics(createApiEvent('toggle-video'));
|
2017-10-09 21:40:38 +00:00
|
|
|
logger.log('Video toggle: API command received');
|
2022-08-30 08:42:29 +00:00
|
|
|
APP.conference.toggleVideoMuted(false /* no UI */, true /* ensure track */);
|
2017-07-20 12:29:15 +00:00
|
|
|
},
|
2018-01-03 21:24:07 +00:00
|
|
|
'toggle-film-strip': () => {
|
|
|
|
sendAnalytics(createApiEvent('film.strip.toggled'));
|
|
|
|
APP.UI.toggleFilmstrip();
|
|
|
|
},
|
2022-09-09 04:12:56 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @param {Object} options - Additional details of how to perform
|
|
|
|
* the action.
|
|
|
|
* @param {number} options.width - width value for film strip.
|
|
|
|
*/
|
|
|
|
'resize-film-strip': (options = {}) => {
|
|
|
|
sendAnalytics(createApiEvent('film.strip.resize'));
|
|
|
|
APP.store.dispatch(resizeFilmStrip(options.width));
|
|
|
|
},
|
2021-03-25 11:48:49 +00:00
|
|
|
'toggle-camera': () => {
|
|
|
|
if (!isToggleCameraEnabled(APP.store.getState())) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
APP.store.dispatch(toggleCamera());
|
|
|
|
},
|
2021-03-25 12:57:41 +00:00
|
|
|
'toggle-camera-mirror': () => {
|
|
|
|
const state = APP.store.getState();
|
|
|
|
const { localFlipX: currentFlipX } = state['features/base/settings'];
|
|
|
|
|
|
|
|
APP.store.dispatch(updateSettings({ localFlipX: !currentFlipX }));
|
|
|
|
},
|
2018-01-03 21:24:07 +00:00
|
|
|
'toggle-chat': () => {
|
|
|
|
sendAnalytics(createApiEvent('chat.toggled'));
|
2021-04-24 13:14:07 +00:00
|
|
|
APP.store.dispatch(toggleChat());
|
2018-01-03 21:24:07 +00:00
|
|
|
},
|
2021-09-29 13:41:23 +00:00
|
|
|
'toggle-moderation': (enabled, mediaType) => {
|
|
|
|
const state = APP.store.getState();
|
|
|
|
|
|
|
|
if (!isLocalParticipantModerator(state)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const enable = mediaType === MEDIA_TYPE.VIDEO
|
|
|
|
? requestEnableVideoModeration : requestEnableAudioModeration;
|
|
|
|
const disable = mediaType === MEDIA_TYPE.VIDEO
|
|
|
|
? requestDisableVideoModeration : requestDisableAudioModeration;
|
|
|
|
|
|
|
|
if (enabled) {
|
|
|
|
APP.store.dispatch(enable());
|
|
|
|
} else {
|
|
|
|
APP.store.dispatch(disable());
|
|
|
|
}
|
|
|
|
},
|
2022-02-01 10:45:54 +00:00
|
|
|
'toggle-participants-pane': enabled => {
|
|
|
|
const toggleParticipantsPane = enabled
|
|
|
|
? openParticipantsPane : closeParticipantsPane;
|
|
|
|
|
|
|
|
APP.store.dispatch(toggleParticipantsPane());
|
|
|
|
},
|
2021-03-22 16:22:45 +00:00
|
|
|
'toggle-raise-hand': () => {
|
|
|
|
const localParticipant = getLocalParticipant(APP.store.getState());
|
|
|
|
|
|
|
|
if (!localParticipant) {
|
|
|
|
return;
|
|
|
|
}
|
2021-10-21 09:40:57 +00:00
|
|
|
const raisedHand = hasRaisedHand(localParticipant);
|
2021-03-22 16:22:45 +00:00
|
|
|
|
|
|
|
sendAnalytics(createApiEvent('raise-hand.toggled'));
|
2021-06-23 11:23:44 +00:00
|
|
|
APP.store.dispatch(raiseHand(!raisedHand));
|
2021-03-22 16:22:45 +00:00
|
|
|
},
|
2021-07-07 08:07:30 +00:00
|
|
|
'toggle-share-audio': () => {
|
|
|
|
sendAnalytics(createApiEvent('audio.screen.sharing.toggled'));
|
|
|
|
if (isScreenAudioSupported()) {
|
|
|
|
APP.store.dispatch(startAudioScreenShareFlow());
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
logger.error('Audio screen sharing is not supported by the current platform!');
|
|
|
|
},
|
2019-08-23 20:16:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback to invoke when the "toggle-share-screen" command is received.
|
|
|
|
*
|
|
|
|
* @param {Object} options - Additional details of how to perform
|
|
|
|
* the action. Note this parameter is undocumented and experimental.
|
|
|
|
* @param {boolean} options.enable - Whether trying to enable screen
|
|
|
|
* sharing or to turn it off.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
'toggle-share-screen': (options = {}) => {
|
2018-01-03 21:24:07 +00:00
|
|
|
sendAnalytics(createApiEvent('screen.sharing.toggled'));
|
2019-08-23 20:16:52 +00:00
|
|
|
toggleScreenSharing(options.enable);
|
2018-01-03 21:24:07 +00:00
|
|
|
},
|
2022-08-04 12:47:49 +00:00
|
|
|
'set-noise-suppression-enabled': (options = {}) => {
|
|
|
|
APP.store.dispatch(setNoiseSuppressionEnabled(options.enabled));
|
|
|
|
},
|
2022-04-20 08:43:18 +00:00
|
|
|
'toggle-subtitles': () => {
|
|
|
|
APP.store.dispatch(toggleRequestingSubtitles());
|
|
|
|
},
|
|
|
|
'set-subtitles': enabled => {
|
|
|
|
APP.store.dispatch(setRequestingSubtitles(enabled));
|
|
|
|
},
|
2019-05-18 20:40:58 +00:00
|
|
|
'toggle-tile-view': () => {
|
|
|
|
sendAnalytics(createApiEvent('tile-view.toggled'));
|
|
|
|
|
|
|
|
APP.store.dispatch(toggleTileView());
|
|
|
|
},
|
2021-03-23 12:18:39 +00:00
|
|
|
'set-tile-view': enabled => {
|
|
|
|
APP.store.dispatch(setTileView(enabled));
|
|
|
|
},
|
2019-05-30 13:28:32 +00:00
|
|
|
'video-hangup': (showFeedbackDialog = true) => {
|
2018-01-03 21:24:07 +00:00
|
|
|
sendAnalytics(createApiEvent('video.hangup'));
|
2019-05-30 13:28:32 +00:00
|
|
|
APP.conference.hangup(showFeedbackDialog);
|
2018-01-03 21:24:07 +00:00
|
|
|
},
|
|
|
|
'email': email => {
|
|
|
|
sendAnalytics(createApiEvent('email.changed'));
|
|
|
|
APP.conference.changeLocalEmail(email);
|
|
|
|
},
|
|
|
|
'avatar-url': avatarUrl => {
|
|
|
|
sendAnalytics(createApiEvent('avatar.url.changed'));
|
|
|
|
APP.conference.changeLocalAvatarUrl(avatarUrl);
|
2020-03-20 11:51:26 +00:00
|
|
|
},
|
2021-06-24 09:37:26 +00:00
|
|
|
'send-chat-message': (message, to, ignorePrivacy = false) => {
|
|
|
|
logger.debug('Send chat message command received');
|
|
|
|
if (to) {
|
|
|
|
const participant = getParticipantById(APP.store.getState(), to);
|
|
|
|
|
|
|
|
if (participant) {
|
|
|
|
APP.store.dispatch(setPrivateMessageRecipient(participant));
|
|
|
|
} else {
|
|
|
|
logger.error(`Participant with id ${to} not found!`);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
APP.store.dispatch(setPrivateMessageRecipient());
|
|
|
|
}
|
|
|
|
|
|
|
|
APP.store.dispatch(sendMessage(message, ignorePrivacy));
|
|
|
|
},
|
2020-03-20 11:51:26 +00:00
|
|
|
'send-endpoint-text-message': (to, text) => {
|
|
|
|
logger.debug('Send endpoint message command received');
|
|
|
|
try {
|
|
|
|
APP.conference.sendEndpointMessage(to, {
|
|
|
|
name: ENDPOINT_TEXT_MESSAGE_NAME,
|
|
|
|
text
|
|
|
|
});
|
|
|
|
} catch (err) {
|
|
|
|
logger.error('Failed sending endpoint text message', err);
|
|
|
|
}
|
2020-04-16 13:26:45 +00:00
|
|
|
},
|
2022-05-20 10:45:09 +00:00
|
|
|
'overwrite-names': participantList => {
|
|
|
|
logger.debug('Overwrite names command received');
|
|
|
|
|
|
|
|
APP.store.dispatch(overwriteParticipantsNames(participantList));
|
|
|
|
},
|
2020-05-07 09:54:02 +00:00
|
|
|
'toggle-e2ee': enabled => {
|
|
|
|
logger.debug('Toggle E2EE key command received');
|
|
|
|
APP.store.dispatch(toggleE2EE(enabled));
|
2020-05-07 18:26:10 +00:00
|
|
|
},
|
2021-11-16 11:12:10 +00:00
|
|
|
'set-media-encryption-key': keyInfo => {
|
|
|
|
APP.store.dispatch(setMediaEncryptionKey(JSON.parse(keyInfo)));
|
|
|
|
},
|
2020-05-07 18:26:10 +00:00
|
|
|
'set-video-quality': frameHeight => {
|
|
|
|
logger.debug('Set video quality command received');
|
|
|
|
sendAnalytics(createApiEvent('set.video.quality'));
|
|
|
|
APP.store.dispatch(setVideoQuality(frameHeight));
|
2020-05-22 19:24:56 +00:00
|
|
|
},
|
|
|
|
|
2021-04-16 09:43:34 +00:00
|
|
|
'start-share-video': url => {
|
|
|
|
logger.debug('Share video command received');
|
|
|
|
sendAnalytics(createApiEvent('share.video.start'));
|
2022-01-14 23:35:31 +00:00
|
|
|
const id = extractYoutubeIdOrURL(url);
|
|
|
|
|
|
|
|
if (id) {
|
|
|
|
APP.store.dispatch(playSharedVideo(id));
|
|
|
|
}
|
2021-04-16 09:43:34 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
'stop-share-video': () => {
|
|
|
|
logger.debug('Share video command received');
|
2021-05-13 11:36:19 +00:00
|
|
|
sendAnalytics(createApiEvent('share.video.stop'));
|
2021-04-16 09:43:34 +00:00
|
|
|
APP.store.dispatch(stopSharedVideo());
|
|
|
|
},
|
|
|
|
|
2022-08-01 10:37:41 +00:00
|
|
|
/**
|
|
|
|
* Shows a custom in-meeting notification.
|
|
|
|
*
|
|
|
|
* @param { string } arg.title - Notification title.
|
|
|
|
* @param { string } arg.description - Notification description.
|
|
|
|
* @param { string } arg.uid - Optional unique identifier for the notification.
|
|
|
|
* @param { string } arg.type - Notification type, either `error`, `info`, `normal`, `success` or `warning`.
|
|
|
|
* Defaults to "normal" if not provided.
|
|
|
|
* @param { string } arg.timeout - Timeout type, either `short`, `medium`, `long` or `sticky`.
|
|
|
|
* Defaults to "short" if not provided.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
'show-notification': ({
|
|
|
|
title,
|
|
|
|
description,
|
|
|
|
uid,
|
|
|
|
type = NOTIFICATION_TYPE.NORMAL,
|
|
|
|
timeout = NOTIFICATION_TIMEOUT_TYPE.SHORT
|
|
|
|
}) => {
|
|
|
|
const validTypes = Object.values(NOTIFICATION_TYPE);
|
|
|
|
const validTimeouts = Object.values(NOTIFICATION_TIMEOUT_TYPE);
|
|
|
|
|
|
|
|
if (!validTypes.includes(type)) {
|
|
|
|
logger.error(`Invalid notification type "${type}". Expecting one of ${validTypes}`);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!validTimeouts.includes(timeout)) {
|
|
|
|
logger.error(`Invalid notification timeout "${timeout}". Expecting one of ${validTimeouts}`);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
APP.store.dispatch(showNotification({
|
|
|
|
uid,
|
|
|
|
title,
|
|
|
|
description,
|
|
|
|
appearance: type
|
|
|
|
}, timeout));
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes a notification given a unique identifier.
|
|
|
|
*
|
|
|
|
* @param { string } uid - Unique identifier for the notification to be removed.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
'hide-notification': uid => {
|
|
|
|
APP.store.dispatch(hideNotification(uid));
|
|
|
|
},
|
|
|
|
|
2020-05-22 19:24:56 +00:00
|
|
|
/**
|
2020-10-20 18:44:44 +00:00
|
|
|
* Starts a file recording or streaming session depending on the passed on params.
|
|
|
|
* For RTMP streams, `rtmpStreamKey` must be passed on. `rtmpBroadcastID` is optional.
|
2020-05-22 19:24:56 +00:00
|
|
|
* For youtube streams, `youtubeStreamKey` must be passed on. `youtubeBroadcastID` is optional.
|
|
|
|
* For dropbox recording, recording `mode` should be `file` and a dropbox oauth2 token must be provided.
|
|
|
|
* For file recording, recording `mode` should be `file` and optionally `shouldShare` could be passed on.
|
2022-09-23 08:46:54 +00:00
|
|
|
* For local recording, recording `mode` should be `local` and optionally `onlySelf` could be passed on.
|
2020-05-22 19:24:56 +00:00
|
|
|
* No other params should be passed.
|
|
|
|
*
|
2022-09-23 08:46:54 +00:00
|
|
|
* @param { string } arg.mode - Recording mode, either `local`, `file` or `stream`.
|
2020-05-22 19:24:56 +00:00
|
|
|
* @param { string } arg.dropboxToken - Dropbox oauth2 token.
|
2022-09-23 08:46:54 +00:00
|
|
|
* @param { boolean } arg.onlySelf - Whether to only record the local streams.
|
2020-10-20 18:44:44 +00:00
|
|
|
* @param { string } arg.rtmpStreamKey - The RTMP stream key.
|
2022-07-14 07:10:08 +00:00
|
|
|
* @param { string } arg.rtmpBroadcastID - The RTMP broadcast ID.
|
2020-05-22 19:24:56 +00:00
|
|
|
* @param { boolean } arg.shouldShare - Whether the recording should be shared with the participants or not.
|
|
|
|
* Only applies to certain jitsi meet deploys.
|
|
|
|
* @param { string } arg.youtubeStreamKey - The youtube stream key.
|
2022-07-14 07:10:08 +00:00
|
|
|
* @param { string } arg.youtubeBroadcastID - The youtube broadcast ID.
|
2020-05-22 19:24:56 +00:00
|
|
|
* @returns {void}
|
|
|
|
*/
|
2020-10-20 18:44:44 +00:00
|
|
|
'start-recording': ({
|
|
|
|
mode,
|
|
|
|
dropboxToken,
|
2022-09-23 08:46:54 +00:00
|
|
|
onlySelf,
|
2020-10-20 18:44:44 +00:00
|
|
|
shouldShare,
|
|
|
|
rtmpStreamKey,
|
|
|
|
rtmpBroadcastID,
|
|
|
|
youtubeStreamKey,
|
|
|
|
youtubeBroadcastID
|
|
|
|
}) => {
|
2020-05-22 19:24:56 +00:00
|
|
|
const state = APP.store.getState();
|
|
|
|
const conference = getCurrentConference(state);
|
|
|
|
|
|
|
|
if (!conference) {
|
|
|
|
logger.error('Conference is not defined');
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dropboxToken && !isDropboxEnabled(state)) {
|
|
|
|
logger.error('Failed starting recording: dropbox is not enabled on this deployment');
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-10-20 18:44:44 +00:00
|
|
|
if (mode === JitsiRecordingConstants.mode.STREAM && !(youtubeStreamKey || rtmpStreamKey)) {
|
|
|
|
logger.error('Failed starting recording: missing youtube or RTMP stream key');
|
2020-05-22 19:24:56 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-09-23 08:46:54 +00:00
|
|
|
if (mode === 'local') {
|
2022-09-23 10:22:37 +00:00
|
|
|
const { localRecording } = state['features/base/config'];
|
|
|
|
|
|
|
|
if (!localRecording?.disable && supportsLocalRecording()) {
|
|
|
|
APP.store.dispatch(startLocalVideoRecording(onlySelf));
|
|
|
|
} else {
|
|
|
|
logger.error('Failed starting recording: local recording is either disabled or not supported');
|
|
|
|
}
|
2022-09-23 08:46:54 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-05-22 19:24:56 +00:00
|
|
|
let recordingConfig;
|
2022-09-23 10:22:37 +00:00
|
|
|
|
2023-01-20 09:44:29 +00:00
|
|
|
if (mode === JitsiRecordingConstants.mode.FILE) {
|
|
|
|
const { recordingService } = state['features/base/config'];
|
2022-09-23 10:22:37 +00:00
|
|
|
|
2023-01-20 09:44:29 +00:00
|
|
|
if (!recordingService.enabled && !dropboxToken) {
|
|
|
|
logger.error('Failed starting recording: the recording service is not enabled');
|
2020-05-22 19:24:56 +00:00
|
|
|
|
2023-01-20 09:44:29 +00:00
|
|
|
return;
|
|
|
|
}
|
2020-05-22 19:24:56 +00:00
|
|
|
if (dropboxToken) {
|
|
|
|
recordingConfig = {
|
|
|
|
mode: JitsiRecordingConstants.mode.FILE,
|
|
|
|
appData: JSON.stringify({
|
|
|
|
'file_recording_metadata': {
|
|
|
|
'upload_credentials': {
|
|
|
|
'service_name': RECORDING_TYPES.DROPBOX,
|
|
|
|
'token': dropboxToken
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
recordingConfig = {
|
|
|
|
mode: JitsiRecordingConstants.mode.FILE,
|
|
|
|
appData: JSON.stringify({
|
|
|
|
'file_recording_metadata': {
|
|
|
|
'share': shouldShare
|
|
|
|
}
|
|
|
|
})
|
|
|
|
};
|
|
|
|
}
|
|
|
|
} else if (mode === JitsiRecordingConstants.mode.STREAM) {
|
|
|
|
recordingConfig = {
|
2020-10-20 18:44:44 +00:00
|
|
|
broadcastId: youtubeBroadcastID || rtmpBroadcastID,
|
2020-05-22 19:24:56 +00:00
|
|
|
mode: JitsiRecordingConstants.mode.STREAM,
|
2020-10-20 18:44:44 +00:00
|
|
|
streamId: youtubeStreamKey || rtmpStreamKey
|
2020-05-22 19:24:56 +00:00
|
|
|
};
|
|
|
|
} else {
|
|
|
|
logger.error('Invalid recording mode provided');
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-01-28 09:11:35 +00:00
|
|
|
if (isScreenshotCaptureEnabled(state, true, false)) {
|
2021-12-08 14:15:59 +00:00
|
|
|
APP.store.dispatch(toggleScreenshotCaptureSummary(true));
|
|
|
|
}
|
2020-05-22 19:24:56 +00:00
|
|
|
conference.startRecording(recordingConfig);
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Stops a recording or streaming in progress.
|
|
|
|
*
|
2022-09-23 08:46:54 +00:00
|
|
|
* @param {string} mode - `local`, `file` or `stream`.
|
2020-05-22 19:24:56 +00:00
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
'stop-recording': mode => {
|
|
|
|
const state = APP.store.getState();
|
|
|
|
const conference = getCurrentConference(state);
|
|
|
|
|
|
|
|
if (!conference) {
|
|
|
|
logger.error('Conference is not defined');
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-09-23 08:46:54 +00:00
|
|
|
if (mode === 'local') {
|
|
|
|
APP.store.dispatch(stopLocalVideoRecording());
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-05-22 19:24:56 +00:00
|
|
|
if (![ JitsiRecordingConstants.mode.FILE, JitsiRecordingConstants.mode.STREAM ].includes(mode)) {
|
|
|
|
logger.error('Invalid recording mode provided!');
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const activeSession = getActiveSession(state, mode);
|
|
|
|
|
|
|
|
if (activeSession && activeSession.id) {
|
2022-01-28 09:11:35 +00:00
|
|
|
APP.store.dispatch(toggleScreenshotCaptureSummary(false));
|
2020-05-22 19:24:56 +00:00
|
|
|
conference.stopRecording(activeSession.id);
|
|
|
|
} else {
|
|
|
|
logger.error('No recording or streaming session found');
|
|
|
|
}
|
2021-01-11 15:21:53 +00:00
|
|
|
},
|
|
|
|
'initiate-private-chat': participantId => {
|
|
|
|
const state = APP.store.getState();
|
|
|
|
const participant = getParticipantById(state, participantId);
|
|
|
|
|
|
|
|
if (participant) {
|
|
|
|
const { isOpen: isChatOpen } = state['features/chat'];
|
|
|
|
|
|
|
|
if (!isChatOpen) {
|
2021-04-24 13:14:07 +00:00
|
|
|
APP.store.dispatch(toggleChat());
|
2021-01-11 15:21:53 +00:00
|
|
|
}
|
2021-02-12 11:18:16 +00:00
|
|
|
APP.store.dispatch(openChat(participant));
|
2021-01-11 15:21:53 +00:00
|
|
|
} else {
|
|
|
|
logger.error('No participant found for the given participantId');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'cancel-private-chat': () => {
|
|
|
|
APP.store.dispatch(setPrivateMessageRecipient());
|
2021-02-11 09:04:36 +00:00
|
|
|
},
|
2022-02-04 10:51:33 +00:00
|
|
|
'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));
|
|
|
|
},
|
2021-02-11 09:04:36 +00:00
|
|
|
'kick-participant': participantId => {
|
|
|
|
APP.store.dispatch(kickParticipant(participantId));
|
2021-03-10 15:39:35 +00:00
|
|
|
},
|
|
|
|
'overwrite-config': config => {
|
|
|
|
const whitelistedConfig = getWhitelistedJSON('config', config);
|
|
|
|
|
|
|
|
APP.store.dispatch(overwriteConfig(whitelistedConfig));
|
2021-05-27 07:57:59 +00:00
|
|
|
},
|
|
|
|
'toggle-virtual-background': () => {
|
|
|
|
APP.store.dispatch(toggleDialog(VirtualBackgroundDialog));
|
2022-09-16 12:29:54 +00:00
|
|
|
},
|
|
|
|
'end-conference': () => {
|
|
|
|
APP.store.dispatch(endConference());
|
|
|
|
const state = APP.store.getState();
|
|
|
|
const conference = getCurrentConference(state);
|
|
|
|
|
|
|
|
if (!conference) {
|
|
|
|
logger.error('Conference not yet available');
|
|
|
|
} else if (conference.isEndConferenceSupported()) {
|
|
|
|
APP.store.dispatch(endConference());
|
|
|
|
} else {
|
|
|
|
logger.error(' End Conference not supported');
|
|
|
|
}
|
2018-01-03 21:24:07 +00:00
|
|
|
}
|
2015-07-02 21:33:06 +00:00
|
|
|
};
|
2017-04-27 20:21:01 +00:00
|
|
|
transport.on('event', ({ data, name }) => {
|
2017-04-17 15:52:31 +00:00
|
|
|
if (name && commands[name]) {
|
|
|
|
commands[name](...data);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
});
|
2018-04-30 12:08:11 +00:00
|
|
|
transport.on('request', (request, callback) => {
|
2019-03-21 12:33:40 +00:00
|
|
|
const { dispatch, getState } = APP.store;
|
|
|
|
|
2019-03-28 16:29:30 +00:00
|
|
|
if (processExternalDeviceRequest(dispatch, getState, request, callback)) {
|
2019-03-21 12:33:40 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-04-30 12:08:11 +00:00
|
|
|
const { name } = request;
|
|
|
|
|
2017-08-04 08:15:11 +00:00
|
|
|
switch (name) {
|
2020-09-18 15:53:27 +00:00
|
|
|
case 'capture-largevideo-screenshot' :
|
|
|
|
APP.store.dispatch(captureLargeVideoScreenshot())
|
|
|
|
.then(dataURL => {
|
|
|
|
let error;
|
|
|
|
|
|
|
|
if (!dataURL) {
|
|
|
|
error = new Error('No large video found!');
|
|
|
|
}
|
|
|
|
|
|
|
|
callback({
|
|
|
|
error,
|
|
|
|
dataURL
|
|
|
|
});
|
|
|
|
});
|
|
|
|
break;
|
2021-10-07 11:49:15 +00:00
|
|
|
case 'deployment-info':
|
|
|
|
callback(APP.store.getState()['features/base/config'].deploymentInfo);
|
|
|
|
break;
|
2018-10-02 13:03:23 +00:00
|
|
|
case 'invite': {
|
2018-08-03 17:06:06 +00:00
|
|
|
const { invitees } = request;
|
|
|
|
|
|
|
|
if (!Array.isArray(invitees) || invitees.length === 0) {
|
|
|
|
callback({
|
|
|
|
error: new Error('Unexpected format of invitees')
|
|
|
|
});
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2018-06-26 22:56:22 +00:00
|
|
|
// The store should be already available because API.init is called
|
|
|
|
// on appWillMount action.
|
2018-04-30 12:08:11 +00:00
|
|
|
APP.store.dispatch(
|
2018-08-03 17:06:06 +00:00
|
|
|
invite(invitees, true))
|
2018-05-03 01:20:31 +00:00
|
|
|
.then(failedInvitees => {
|
|
|
|
let error;
|
|
|
|
let result;
|
|
|
|
|
|
|
|
if (failedInvitees.length) {
|
|
|
|
error = new Error('One or more invites failed!');
|
|
|
|
} else {
|
|
|
|
result = true;
|
|
|
|
}
|
2018-04-30 12:08:11 +00:00
|
|
|
|
|
|
|
callback({
|
2018-05-03 01:20:31 +00:00
|
|
|
error,
|
|
|
|
result
|
2018-04-30 12:08:11 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
break;
|
2018-10-02 13:03:23 +00:00
|
|
|
}
|
2017-08-04 08:15:11 +00:00
|
|
|
case 'is-audio-muted':
|
2017-08-28 21:56:27 +00:00
|
|
|
callback(APP.conference.isLocalAudioMuted());
|
2017-08-04 08:15:11 +00:00
|
|
|
break;
|
2022-04-26 12:32:18 +00:00
|
|
|
case 'is-audio-disabled':
|
|
|
|
callback(isAudioMuteButtonDisabled(APP.store.getState()));
|
|
|
|
break;
|
2021-09-29 13:41:23 +00:00
|
|
|
case 'is-moderation-on': {
|
|
|
|
const { mediaType } = request;
|
|
|
|
const type = mediaType || MEDIA_TYPE.AUDIO;
|
|
|
|
|
|
|
|
callback(isEnabledFromState(type, APP.store.getState()));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'is-participant-force-muted': {
|
|
|
|
const state = APP.store.getState();
|
|
|
|
const { participantId, mediaType } = request;
|
|
|
|
const type = mediaType || MEDIA_TYPE.AUDIO;
|
|
|
|
const participant = getParticipantById(state, participantId);
|
|
|
|
|
|
|
|
callback(isForceMuted(participant, type, state));
|
|
|
|
break;
|
|
|
|
}
|
2022-02-01 10:45:54 +00:00
|
|
|
case 'is-participants-pane-open': {
|
|
|
|
callback(getParticipantsPaneOpen(APP.store.getState()));
|
|
|
|
break;
|
|
|
|
}
|
2017-08-04 08:15:11 +00:00
|
|
|
case 'is-video-muted':
|
2017-08-28 21:56:27 +00:00
|
|
|
callback(APP.conference.isLocalVideoMuted());
|
2017-08-04 08:15:11 +00:00
|
|
|
break;
|
|
|
|
case 'is-audio-available':
|
|
|
|
callback(audioAvailable);
|
|
|
|
break;
|
|
|
|
case 'is-video-available':
|
|
|
|
callback(videoAvailable);
|
|
|
|
break;
|
2020-05-20 00:21:03 +00:00
|
|
|
case 'is-sharing-screen':
|
|
|
|
callback(Boolean(APP.conference.isSharingScreen));
|
|
|
|
break;
|
2022-04-18 13:19:19 +00:00
|
|
|
case 'is-start-silent':
|
|
|
|
callback(Boolean(APP.store.getState()['features/base/config'].startSilent));
|
|
|
|
break;
|
2021-01-12 09:13:20 +00:00
|
|
|
case 'get-content-sharing-participants': {
|
2022-10-07 14:32:07 +00:00
|
|
|
const sharingParticipantIds = getScreenshareParticipantIds(APP.store.getState());
|
2021-01-12 09:13:20 +00:00
|
|
|
|
|
|
|
callback({
|
|
|
|
sharingParticipantIds
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
}
|
2021-02-09 11:43:38 +00:00
|
|
|
case 'get-livestream-url': {
|
|
|
|
const state = APP.store.getState();
|
|
|
|
const conference = getCurrentConference(state);
|
|
|
|
let livestreamUrl;
|
|
|
|
|
|
|
|
if (conference) {
|
|
|
|
const activeSession = getActiveSession(state, JitsiRecordingConstants.mode.STREAM);
|
|
|
|
|
|
|
|
livestreamUrl = activeSession?.liveStreamViewURL;
|
|
|
|
} else {
|
|
|
|
logger.error('Conference is not defined');
|
|
|
|
}
|
|
|
|
callback({
|
|
|
|
livestreamUrl
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
}
|
2021-07-20 11:37:22 +00:00
|
|
|
case 'get-custom-avatar-backgrounds' : {
|
|
|
|
callback({
|
|
|
|
avatarBackgrounds: APP.store.getState()['features/dynamic-branding'].avatarBackgrounds
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
}
|
2022-02-04 10:51:33 +00:00
|
|
|
case 'list-breakout-rooms': {
|
|
|
|
callback(getBreakoutRooms(APP.store.getState()));
|
|
|
|
break;
|
|
|
|
}
|
2022-09-06 06:51:38 +00:00
|
|
|
case 'rooms-info': {
|
|
|
|
callback(getRoomsInfo(APP.store.getState()));
|
|
|
|
break;
|
|
|
|
}
|
2017-08-04 08:15:11 +00:00
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
});
|
2015-07-02 21:33:06 +00:00
|
|
|
}
|
2015-01-09 13:39:32 +00:00
|
|
|
|
2016-01-14 15:05:54 +00:00
|
|
|
/**
|
|
|
|
* Check whether the API should be enabled or not.
|
2017-04-11 18:02:59 +00:00
|
|
|
*
|
2016-01-14 15:05:54 +00:00
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
2017-04-11 18:02:59 +00:00
|
|
|
function shouldBeEnabled() {
|
2017-05-26 22:11:33 +00:00
|
|
|
return (
|
|
|
|
typeof API_ID === 'number'
|
|
|
|
|
|
|
|
// XXX Enable the API when a JSON Web Token (JWT) is specified in
|
|
|
|
// the location/URL because then it is very likely that the Jitsi
|
|
|
|
// Meet (Web) app is being used by an external/wrapping (Web) app
|
|
|
|
// and, consequently, the latter will need to communicate with the
|
|
|
|
// former. (The described logic is merely a heuristic though.)
|
|
|
|
|| parseJWTFromURLParams());
|
2015-01-23 15:36:17 +00:00
|
|
|
}
|
|
|
|
|
2016-01-14 15:05:54 +00:00
|
|
|
/**
|
2017-04-11 19:30:00 +00:00
|
|
|
* Executes on toggle-share-screen command.
|
2017-04-11 18:02:59 +00:00
|
|
|
*
|
2019-08-23 20:16:52 +00:00
|
|
|
* @param {boolean} [enable] - Whether this toggle is to explicitly enable or
|
|
|
|
* disable screensharing. If not defined, the application will automatically
|
|
|
|
* attempt to toggle between enabled and disabled. This boolean is useful for
|
|
|
|
* explicitly setting desired screensharing state.
|
2017-04-11 18:02:59 +00:00
|
|
|
* @returns {void}
|
2016-01-14 15:05:54 +00:00
|
|
|
*/
|
2019-08-23 20:16:52 +00:00
|
|
|
function toggleScreenSharing(enable) {
|
2020-11-03 09:44:41 +00:00
|
|
|
if (JitsiMeetJS.isDesktopSharingEnabled()) {
|
2021-07-07 08:07:30 +00:00
|
|
|
APP.store.dispatch(startScreenShareFlow(enable));
|
2016-01-14 15:05:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-09 10:09:08 +00:00
|
|
|
/**
|
|
|
|
* Removes sensitive data from a mouse event.
|
|
|
|
*
|
|
|
|
* @param {MouseEvent} event - The mouse event to sanitize.
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
|
|
|
function sanitizeMouseEvent(event: MouseEvent) {
|
|
|
|
const {
|
|
|
|
clientX,
|
|
|
|
clientY,
|
|
|
|
movementX,
|
|
|
|
movementY,
|
|
|
|
offsetX,
|
|
|
|
offsetY,
|
|
|
|
pageX,
|
|
|
|
pageY,
|
|
|
|
x,
|
|
|
|
y,
|
|
|
|
screenX,
|
|
|
|
screenY
|
|
|
|
} = event;
|
|
|
|
|
|
|
|
return {
|
|
|
|
clientX,
|
|
|
|
clientY,
|
|
|
|
movementX,
|
|
|
|
movementY,
|
|
|
|
offsetX,
|
|
|
|
offsetY,
|
|
|
|
pageX,
|
|
|
|
pageY,
|
|
|
|
x,
|
|
|
|
y,
|
|
|
|
screenX,
|
|
|
|
screenY
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2017-04-11 18:02:59 +00:00
|
|
|
/**
|
2017-04-11 19:30:00 +00:00
|
|
|
* Implements API class that communicates with external API class and provides
|
|
|
|
* interface to access Jitsi Meet features by external applications that embed
|
|
|
|
* Jitsi Meet.
|
2017-04-11 18:02:59 +00:00
|
|
|
*/
|
2016-12-20 22:15:13 +00:00
|
|
|
class API {
|
2017-10-02 23:08:07 +00:00
|
|
|
_enabled: boolean;
|
|
|
|
|
2015-01-09 13:39:32 +00:00
|
|
|
/**
|
2017-04-11 19:30:00 +00:00
|
|
|
* Initializes the API. Setups message event listeners that will receive
|
|
|
|
* information from external applications that embed Jitsi Meet. It also
|
|
|
|
* sends a message to the external application that API is initialized.
|
2017-04-11 18:02:59 +00:00
|
|
|
*
|
|
|
|
* @param {Object} options - Optional parameters.
|
|
|
|
* @returns {void}
|
2015-01-09 13:39:32 +00:00
|
|
|
*/
|
2017-05-26 22:11:33 +00:00
|
|
|
init() {
|
|
|
|
if (!shouldBeEnabled()) {
|
2016-01-14 15:05:54 +00:00
|
|
|
return;
|
2017-04-11 18:02:59 +00:00
|
|
|
}
|
2016-06-13 21:11:44 +00:00
|
|
|
|
2017-04-17 15:52:31 +00:00
|
|
|
/**
|
|
|
|
* Current status (enabled/disabled) of API.
|
2017-04-27 20:21:01 +00:00
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @type {boolean}
|
2017-04-17 15:52:31 +00:00
|
|
|
*/
|
2017-04-27 20:21:01 +00:00
|
|
|
this._enabled = true;
|
2017-04-17 15:52:31 +00:00
|
|
|
|
|
|
|
initCommands();
|
2021-09-15 12:56:21 +00:00
|
|
|
this.notifyBrowserSupport(isSupportedBrowser());
|
2016-12-20 22:15:13 +00:00
|
|
|
}
|
|
|
|
|
2017-12-05 03:27:17 +00:00
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) that the large video
|
|
|
|
* visibility changed.
|
|
|
|
*
|
|
|
|
* @param {boolean} isHidden - True if the large video is hidden and false
|
|
|
|
* otherwise.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyLargeVideoVisibilityChanged(isHidden: boolean) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'large-video-visibility-changed',
|
|
|
|
isVisible: !isHidden
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-01-26 20:53:11 +00:00
|
|
|
/**
|
|
|
|
* Notifies the external application (spot) that the local jitsi-participant
|
|
|
|
* has a status update.
|
|
|
|
*
|
|
|
|
* @param {Object} event - The message to pass onto spot.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
sendProxyConnectionEvent(event: Object) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'proxy-connection-event',
|
|
|
|
...event
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2016-12-20 22:15:13 +00:00
|
|
|
/**
|
2017-05-01 20:59:18 +00:00
|
|
|
* Sends event to the external application.
|
2017-04-11 18:02:59 +00:00
|
|
|
*
|
2017-05-01 20:59:18 +00:00
|
|
|
* @param {Object} event - The event to be sent.
|
2017-04-11 18:02:59 +00:00
|
|
|
* @returns {void}
|
2016-12-20 22:15:13 +00:00
|
|
|
*/
|
2017-10-02 23:08:07 +00:00
|
|
|
_sendEvent(event: Object = {}) {
|
2017-04-27 20:21:01 +00:00
|
|
|
if (this._enabled) {
|
2017-05-01 20:59:18 +00:00
|
|
|
transport.sendEvent(event);
|
2017-04-11 18:02:59 +00:00
|
|
|
}
|
2016-12-20 22:15:13 +00:00
|
|
|
}
|
2016-01-14 15:05:54 +00:00
|
|
|
|
2021-01-28 09:39:17 +00:00
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) that the chat state has been updated.
|
|
|
|
*
|
|
|
|
* @param {number} unreadCount - The unread messages counter.
|
|
|
|
* @param {boolean} isOpen - True if the chat panel is open.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyChatUpdated(unreadCount: number, isOpen: boolean) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'chat-updated',
|
|
|
|
unreadCount,
|
|
|
|
isOpen
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2016-01-14 15:05:54 +00:00
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) that message was sent.
|
2017-04-11 18:02:59 +00:00
|
|
|
*
|
2017-04-17 15:52:31 +00:00
|
|
|
* @param {string} message - Message body.
|
2020-04-01 08:21:18 +00:00
|
|
|
* @param {boolean} privateMessage - True if the message was a private message.
|
2017-04-11 18:02:59 +00:00
|
|
|
* @returns {void}
|
2016-01-14 15:05:54 +00:00
|
|
|
*/
|
2020-04-01 08:21:18 +00:00
|
|
|
notifySendingChatMessage(message: string, privateMessage: boolean) {
|
2017-05-01 20:59:18 +00:00
|
|
|
this._sendEvent({
|
|
|
|
name: 'outgoing-message',
|
2020-04-01 08:21:18 +00:00
|
|
|
message,
|
|
|
|
privateMessage
|
2017-05-01 20:59:18 +00:00
|
|
|
});
|
2016-12-20 22:15:13 +00:00
|
|
|
}
|
2016-06-13 21:11:44 +00:00
|
|
|
|
2021-06-09 10:09:08 +00:00
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) that the mouse has entered inside the iframe.
|
|
|
|
*
|
|
|
|
* @param {MouseEvent} event - The mousemove event.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyMouseEnter(event: MouseEvent) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'mouse-enter',
|
|
|
|
event: sanitizeMouseEvent(event)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) that the mouse has entered inside the iframe.
|
|
|
|
*
|
|
|
|
* @param {MouseEvent} event - The mousemove event.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyMouseLeave(event: MouseEvent) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'mouse-leave',
|
|
|
|
event: sanitizeMouseEvent(event)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) that the mouse has moved inside the iframe.
|
|
|
|
*
|
|
|
|
* @param {MouseEvent} event - The mousemove event.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyMouseMove(event: MouseEvent) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'mouse-move',
|
|
|
|
event: sanitizeMouseEvent(event)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-09-29 13:41:23 +00:00
|
|
|
/**
|
|
|
|
* Notify the external application that the moderation status has changed.
|
|
|
|
*
|
|
|
|
* @param {string} mediaType - Media type for which the moderation changed.
|
|
|
|
* @param {boolean} enabled - Whether or not the new moderation status is enabled.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyModerationChanged(mediaType: string, enabled: boolean) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'moderation-status-changed',
|
|
|
|
mediaType,
|
|
|
|
enabled
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Notify the external application that a participant was approved on moderation.
|
|
|
|
*
|
|
|
|
* @param {string} participantId - The ID of the participant that got approved.
|
|
|
|
* @param {string} mediaType - Media type for which the participant was approved.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyParticipantApproved(participantId: string, mediaType: string) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'moderation-participant-approved',
|
|
|
|
id: participantId,
|
|
|
|
mediaType
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Notify the external application that a participant was rejected on moderation.
|
|
|
|
*
|
|
|
|
* @param {string} participantId - The ID of the participant that got rejected.
|
|
|
|
* @param {string} mediaType - Media type for which the participant was rejected.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyParticipantRejected(participantId: string, mediaType: string) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'moderation-participant-rejected',
|
|
|
|
id: participantId,
|
|
|
|
mediaType
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-09-03 22:40:54 +00:00
|
|
|
/**
|
|
|
|
* Notify external application that the video quality setting has changed.
|
|
|
|
*
|
|
|
|
* @param {number} videoQuality - The video quality. The number represents the maximum height of the video streams.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyVideoQualityChanged(videoQuality: number) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'video-quality-changed',
|
|
|
|
videoQuality
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2015-01-09 13:39:32 +00:00
|
|
|
/**
|
2017-04-11 19:30:00 +00:00
|
|
|
* Notify external application (if API is enabled) that message was
|
|
|
|
* received.
|
2017-04-11 18:02:59 +00:00
|
|
|
*
|
|
|
|
* @param {Object} options - Object with the message properties.
|
|
|
|
* @returns {void}
|
2015-01-09 13:39:32 +00:00
|
|
|
*/
|
2017-10-03 19:24:00 +00:00
|
|
|
notifyReceivedChatMessage(
|
2021-01-13 11:02:58 +00:00
|
|
|
{ body, id, nick, privateMessage, ts }: {
|
|
|
|
body: *, id: string, nick: string, privateMessage: boolean, ts: *
|
2017-10-03 19:24:00 +00:00
|
|
|
} = {}) {
|
2016-01-14 15:05:54 +00:00
|
|
|
if (APP.conference.isLocalId(id)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-05-01 20:59:18 +00:00
|
|
|
this._sendEvent({
|
|
|
|
name: 'incoming-message',
|
2017-04-17 15:52:31 +00:00
|
|
|
from: id,
|
|
|
|
message: body,
|
2017-04-27 20:21:01 +00:00
|
|
|
nick,
|
2021-01-13 11:02:58 +00:00
|
|
|
privateMessage,
|
2017-04-17 15:52:31 +00:00
|
|
|
stamp: ts
|
|
|
|
});
|
2016-12-20 22:15:13 +00:00
|
|
|
}
|
2015-01-09 13:39:32 +00:00
|
|
|
|
|
|
|
/**
|
2017-04-11 19:30:00 +00:00
|
|
|
* Notify external application (if API is enabled) that user joined the
|
|
|
|
* conference.
|
2017-04-11 18:02:59 +00:00
|
|
|
*
|
|
|
|
* @param {string} id - User id.
|
2017-12-05 03:27:17 +00:00
|
|
|
* @param {Object} props - The display name of the user.
|
2017-04-11 18:02:59 +00:00
|
|
|
* @returns {void}
|
2015-01-09 13:39:32 +00:00
|
|
|
*/
|
2017-12-05 03:27:17 +00:00
|
|
|
notifyUserJoined(id: string, props: Object) {
|
2017-05-01 20:59:18 +00:00
|
|
|
this._sendEvent({
|
|
|
|
name: 'participant-joined',
|
2017-12-05 03:27:17 +00:00
|
|
|
id,
|
|
|
|
...props
|
2017-05-01 20:59:18 +00:00
|
|
|
});
|
2016-12-20 22:15:13 +00:00
|
|
|
}
|
2016-01-14 15:05:54 +00:00
|
|
|
|
|
|
|
/**
|
2017-04-11 19:30:00 +00:00
|
|
|
* Notify external application (if API is enabled) that user left the
|
|
|
|
* conference.
|
2017-04-11 18:02:59 +00:00
|
|
|
*
|
|
|
|
* @param {string} id - User id.
|
|
|
|
* @returns {void}
|
2016-01-14 15:05:54 +00:00
|
|
|
*/
|
2017-10-02 23:08:07 +00:00
|
|
|
notifyUserLeft(id: string) {
|
2017-05-01 20:59:18 +00:00
|
|
|
this._sendEvent({
|
|
|
|
name: 'participant-left',
|
|
|
|
id
|
|
|
|
});
|
2016-12-20 22:15:13 +00:00
|
|
|
}
|
2016-01-14 15:05:54 +00:00
|
|
|
|
2020-05-05 14:03:54 +00:00
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) that the user role
|
|
|
|
* has changed.
|
|
|
|
*
|
|
|
|
* @param {string} id - User id.
|
|
|
|
* @param {string} role - The new user role.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyUserRoleChanged(id: string, role: string) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'participant-role-changed',
|
|
|
|
id,
|
|
|
|
role
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-12-05 03:27:17 +00:00
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) that user changed their
|
|
|
|
* avatar.
|
|
|
|
*
|
|
|
|
* @param {string} id - User id.
|
|
|
|
* @param {string} avatarURL - The new avatar URL of the participant.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyAvatarChanged(id: string, avatarURL: string) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'avatar-changed',
|
|
|
|
avatarURL,
|
|
|
|
id
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-03-20 11:51:26 +00:00
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) that user received
|
|
|
|
* a text message through datachannels.
|
|
|
|
*
|
|
|
|
* @param {Object} data - The event data.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyEndpointTextMessageReceived(data: Object) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'endpoint-text-message-received',
|
|
|
|
data
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-04-08 07:12:38 +00:00
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) that some face landmark data is available.
|
|
|
|
*
|
|
|
|
* @param {Object | undefined} faceBox - Detected face(s) bounding box (left, right, width).
|
|
|
|
* @param {string} faceExpression - Detected face expression.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyFaceLandmarkDetected(faceBox: Object, faceExpression: string) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'face-landmark-detected',
|
|
|
|
faceBox,
|
|
|
|
faceExpression
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-01-12 09:13:20 +00:00
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) that the list of sharing participants changed.
|
|
|
|
*
|
|
|
|
* @param {Object} data - The event data.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifySharingParticipantsChanged(data: Object) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'content-sharing-participants-changed',
|
|
|
|
data
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-03-28 12:21:38 +00:00
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) that the device list has
|
|
|
|
* changed.
|
|
|
|
*
|
|
|
|
* @param {Object} devices - The new device list.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyDeviceListChanged(devices: Object) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'device-list-changed',
|
2020-05-22 19:24:56 +00:00
|
|
|
devices
|
|
|
|
});
|
2019-03-28 12:21:38 +00:00
|
|
|
}
|
|
|
|
|
2016-01-14 15:05:54 +00:00
|
|
|
/**
|
2017-04-11 19:30:00 +00:00
|
|
|
* Notify external application (if API is enabled) that user changed their
|
|
|
|
* nickname.
|
2017-04-11 18:02:59 +00:00
|
|
|
*
|
|
|
|
* @param {string} id - User id.
|
2017-04-17 15:52:31 +00:00
|
|
|
* @param {string} displayname - User nickname.
|
2017-12-05 03:27:17 +00:00
|
|
|
* @param {string} formattedDisplayName - The display name shown in Jitsi
|
|
|
|
* meet's UI for the user.
|
2017-04-11 18:02:59 +00:00
|
|
|
* @returns {void}
|
2016-01-14 15:05:54 +00:00
|
|
|
*/
|
2017-12-05 03:27:17 +00:00
|
|
|
notifyDisplayNameChanged(
|
|
|
|
id: string,
|
|
|
|
{ displayName, formattedDisplayName }: Object) {
|
2017-05-02 22:39:36 +00:00
|
|
|
this._sendEvent({
|
|
|
|
name: 'display-name-change',
|
2017-12-05 03:27:17 +00:00
|
|
|
displayname: displayName,
|
|
|
|
formattedDisplayName,
|
2017-04-27 20:21:01 +00:00
|
|
|
id
|
2017-04-17 15:52:31 +00:00
|
|
|
});
|
2016-12-20 22:15:13 +00:00
|
|
|
}
|
2016-06-17 20:35:40 +00:00
|
|
|
|
2018-06-18 09:19:07 +00:00
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) that user changed their
|
|
|
|
* email.
|
|
|
|
*
|
|
|
|
* @param {string} id - User id.
|
|
|
|
* @param {string} email - The new email of the participant.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyEmailChanged(
|
|
|
|
id: string,
|
|
|
|
{ email }: Object) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'email-change',
|
|
|
|
email,
|
|
|
|
id
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-07-28 07:39:54 +00:00
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) that the an error has been logged.
|
|
|
|
*
|
|
|
|
* @param {string} logLevel - The message log level.
|
|
|
|
* @param {Array} args - Array of strings composing the log message.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyLog(logLevel: string, args: Array<string>) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'log',
|
|
|
|
logLevel,
|
|
|
|
args
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2016-06-17 20:35:40 +00:00
|
|
|
/**
|
2017-04-11 19:30:00 +00:00
|
|
|
* Notify external application (if API is enabled) that the conference has
|
|
|
|
* been joined.
|
2017-04-11 18:02:59 +00:00
|
|
|
*
|
2017-04-17 15:52:31 +00:00
|
|
|
* @param {string} roomName - The room name.
|
2017-12-05 03:27:17 +00:00
|
|
|
* @param {string} id - The id of the local user.
|
2022-02-02 11:28:07 +00:00
|
|
|
* @param {Object} props - The display name, the avatar URL of the local
|
|
|
|
* user and the type of the room.
|
2017-04-11 18:02:59 +00:00
|
|
|
* @returns {void}
|
2016-06-17 20:35:40 +00:00
|
|
|
*/
|
2017-12-05 03:27:17 +00:00
|
|
|
notifyConferenceJoined(roomName: string, id: string, props: Object) {
|
2017-05-01 20:59:18 +00:00
|
|
|
this._sendEvent({
|
|
|
|
name: 'video-conference-joined',
|
2017-12-05 03:27:17 +00:00
|
|
|
roomName,
|
|
|
|
id,
|
|
|
|
...props
|
2017-05-01 20:59:18 +00:00
|
|
|
});
|
2016-12-20 22:15:13 +00:00
|
|
|
}
|
2016-06-17 20:35:40 +00:00
|
|
|
|
|
|
|
/**
|
2020-09-14 20:01:46 +00:00
|
|
|
* Notify external application (if API is enabled) that local user has left the conference.
|
2017-04-11 18:02:59 +00:00
|
|
|
*
|
2017-04-17 15:52:31 +00:00
|
|
|
* @param {string} roomName - User id.
|
2017-04-11 18:02:59 +00:00
|
|
|
* @returns {void}
|
2016-06-17 20:35:40 +00:00
|
|
|
*/
|
2017-10-02 23:08:07 +00:00
|
|
|
notifyConferenceLeft(roomName: string) {
|
2017-05-01 20:59:18 +00:00
|
|
|
this._sendEvent({
|
|
|
|
name: 'video-conference-left',
|
|
|
|
roomName
|
|
|
|
});
|
2016-12-20 22:15:13 +00:00
|
|
|
}
|
2015-01-09 13:39:32 +00:00
|
|
|
|
2022-11-18 10:32:15 +00:00
|
|
|
/**
|
|
|
|
* Notify external application that the data channel has been closed.
|
|
|
|
*
|
|
|
|
* @param {number} code - The close code.
|
|
|
|
* @param {string} reason - The close reason.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyDataChannelClosed(code: number, reason: string) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'data-channel-closed',
|
|
|
|
code,
|
|
|
|
reason
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-09-30 09:57:17 +00:00
|
|
|
/**
|
|
|
|
* Notify external application that the data channel has been opened.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyDataChannelOpened() {
|
|
|
|
this._sendEvent({ name: 'data-channel-opened' });
|
|
|
|
}
|
|
|
|
|
2016-10-05 21:33:09 +00:00
|
|
|
/**
|
2017-04-11 19:30:00 +00:00
|
|
|
* Notify external application (if API is enabled) that we are ready to be
|
|
|
|
* closed.
|
2017-04-11 18:02:59 +00:00
|
|
|
*
|
|
|
|
* @returns {void}
|
2016-10-05 21:33:09 +00:00
|
|
|
*/
|
2017-04-11 18:02:59 +00:00
|
|
|
notifyReadyToClose() {
|
2017-05-01 20:59:18 +00:00
|
|
|
this._sendEvent({ name: 'video-ready-to-close' });
|
2016-12-20 22:15:13 +00:00
|
|
|
}
|
2016-10-05 21:33:09 +00:00
|
|
|
|
2019-06-26 14:20:51 +00:00
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) that a suspend event in host computer.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifySuspendDetected() {
|
|
|
|
this._sendEvent({ name: 'suspend-detected' });
|
|
|
|
}
|
|
|
|
|
2017-08-04 08:15:11 +00:00
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) for audio muted status
|
|
|
|
* changed.
|
|
|
|
*
|
|
|
|
* @param {boolean} muted - The new muted status.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2017-10-02 23:08:07 +00:00
|
|
|
notifyAudioMutedStatusChanged(muted: boolean) {
|
2017-08-04 08:15:11 +00:00
|
|
|
this._sendEvent({
|
|
|
|
name: 'audio-mute-status-changed',
|
|
|
|
muted
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) for video muted status
|
|
|
|
* changed.
|
|
|
|
*
|
|
|
|
* @param {boolean} muted - The new muted status.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2017-10-02 23:08:07 +00:00
|
|
|
notifyVideoMutedStatusChanged(muted: boolean) {
|
2017-08-04 08:15:11 +00:00
|
|
|
this._sendEvent({
|
|
|
|
name: 'video-mute-status-changed',
|
|
|
|
muted
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) for audio availability
|
|
|
|
* changed.
|
|
|
|
*
|
|
|
|
* @param {boolean} available - True if available and false otherwise.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2017-10-02 23:08:07 +00:00
|
|
|
notifyAudioAvailabilityChanged(available: boolean) {
|
2017-08-04 08:15:11 +00:00
|
|
|
audioAvailable = available;
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'audio-availability-changed',
|
|
|
|
available
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) for video available
|
|
|
|
* status changed.
|
|
|
|
*
|
|
|
|
* @param {boolean} available - True if available and false otherwise.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2017-10-02 23:08:07 +00:00
|
|
|
notifyVideoAvailabilityChanged(available: boolean) {
|
2017-08-04 08:15:11 +00:00
|
|
|
videoAvailable = available;
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'video-availability-changed',
|
|
|
|
available
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-12-05 03:27:17 +00:00
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) that the on stage
|
|
|
|
* participant has changed.
|
|
|
|
*
|
|
|
|
* @param {string} id - User id of the new on stage participant.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyOnStageParticipantChanged(id: string) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'on-stage-participant-changed',
|
|
|
|
id
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-08-30 08:42:29 +00:00
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) that the prejoin video
|
|
|
|
* visibility had changed.
|
|
|
|
*
|
|
|
|
* @param {boolean} isVisible - Whether the prejoin video is visible.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyPrejoinVideoVisibilityChanged(isVisible: boolean) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'on-prejoin-video-changed',
|
|
|
|
isVisible
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) that the prejoin
|
|
|
|
* screen was loaded.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyPrejoinLoaded() {
|
|
|
|
const state = APP.store.getState();
|
|
|
|
const { defaultLocalDisplayName } = state['features/base/config'];
|
|
|
|
const displayName = getDisplayName(state);
|
|
|
|
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'prejoin-screen-loaded',
|
|
|
|
id: LOCAL_PARTICIPANT_DEFAULT_ID,
|
|
|
|
displayName,
|
|
|
|
formattedDisplayName: appendSuffix(displayName, defaultLocalDisplayName)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-05-29 21:17:07 +00:00
|
|
|
/**
|
|
|
|
* Notify external application of an unexpected camera-related error having
|
|
|
|
* occurred.
|
|
|
|
*
|
|
|
|
* @param {string} type - The type of the camera error.
|
|
|
|
* @param {string} message - Additional information about the error.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyOnCameraError(type: string, message: string) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'camera-error',
|
|
|
|
type,
|
|
|
|
message
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Notify external application of an unexpected mic-related error having
|
|
|
|
* occurred.
|
|
|
|
*
|
|
|
|
* @param {string} type - The type of the mic error.
|
|
|
|
* @param {string} message - Additional information about the error.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyOnMicError(type: string, message: string) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'mic-error',
|
|
|
|
type,
|
|
|
|
message
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-01-19 22:19:55 +00:00
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) that conference feedback
|
|
|
|
* has been submitted. Intended to be used in conjunction with the
|
|
|
|
* submit-feedback command to get notified if feedback was submitted.
|
|
|
|
*
|
2019-07-31 17:59:22 +00:00
|
|
|
* @param {string} error - A failure message, if any.
|
2018-01-19 22:19:55 +00:00
|
|
|
* @returns {void}
|
|
|
|
*/
|
2019-07-31 17:59:22 +00:00
|
|
|
notifyFeedbackSubmitted(error: string) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'feedback-submitted',
|
|
|
|
error
|
|
|
|
});
|
2018-01-19 22:19:55 +00:00
|
|
|
}
|
2017-08-04 08:15:11 +00:00
|
|
|
|
2019-02-19 22:18:49 +00:00
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) that the feedback prompt
|
|
|
|
* has been displayed.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyFeedbackPromptDisplayed() {
|
|
|
|
this._sendEvent({ name: 'feedback-prompt-displayed' });
|
|
|
|
}
|
|
|
|
|
2019-03-11 18:17:28 +00:00
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) that the display
|
|
|
|
* configuration of the filmstrip has been changed.
|
|
|
|
*
|
|
|
|
* @param {boolean} visible - Whether or not the filmstrip has been set to
|
|
|
|
* be displayed or hidden.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyFilmstripDisplayChanged(visible: boolean) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'filmstrip-display-changed',
|
|
|
|
visible
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-06-28 22:22:43 +00:00
|
|
|
/**
|
|
|
|
* Notify external application of a participant, remote or local, being
|
|
|
|
* removed from the conference by another participant.
|
|
|
|
*
|
|
|
|
* @param {string} kicked - The ID of the participant removed from the
|
|
|
|
* conference.
|
|
|
|
* @param {string} kicker - The ID of the participant that removed the
|
|
|
|
* other participant.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyKickedOut(kicked: Object, kicker: Object) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'participant-kicked-out',
|
|
|
|
kicked,
|
|
|
|
kicker
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-06-08 17:35:11 +00:00
|
|
|
/**
|
|
|
|
* Notify external application of the current meeting requiring a password
|
|
|
|
* to join.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyOnPasswordRequired() {
|
|
|
|
this._sendEvent({ name: 'password-required' });
|
|
|
|
}
|
|
|
|
|
2018-01-30 13:43:06 +00:00
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) that the screen sharing
|
|
|
|
* has been turned on/off.
|
|
|
|
*
|
|
|
|
* @param {boolean} on - True if screen sharing is enabled.
|
2019-03-07 05:46:17 +00:00
|
|
|
* @param {Object} details - Additional information about the screen
|
|
|
|
* sharing.
|
|
|
|
* @param {string} details.sourceType - Type of device or window the screen
|
|
|
|
* share is capturing.
|
2018-01-30 13:43:06 +00:00
|
|
|
* @returns {void}
|
|
|
|
*/
|
2019-03-07 05:46:17 +00:00
|
|
|
notifyScreenSharingStatusChanged(on: boolean, details: Object) {
|
2018-01-30 13:43:06 +00:00
|
|
|
this._sendEvent({
|
|
|
|
name: 'screen-sharing-status-changed',
|
2019-03-07 05:46:17 +00:00
|
|
|
on,
|
|
|
|
details
|
2018-01-30 13:43:06 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-08-09 08:09:33 +00:00
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) that the dominant speaker
|
|
|
|
* has been turned on/off.
|
|
|
|
*
|
|
|
|
* @param {string} id - Id of the dominant participant.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyDominantSpeakerChanged(id: string) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'dominant-speaker-changed',
|
|
|
|
id
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-02-17 14:40:24 +00:00
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) that the conference
|
|
|
|
* changed their subject.
|
|
|
|
*
|
|
|
|
* @param {string} subject - Conference subject.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifySubjectChanged(subject: string) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'subject-change',
|
|
|
|
subject
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-05-18 20:40:58 +00:00
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) that tile view has been
|
|
|
|
* entered or exited.
|
|
|
|
*
|
|
|
|
* @param {string} enabled - True if tile view is currently displayed, false
|
|
|
|
* otherwise.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyTileViewChanged(enabled: boolean) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'tile-view-changed',
|
|
|
|
enabled
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-09-25 22:51:54 +00:00
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) that the localStorage has changed.
|
|
|
|
*
|
|
|
|
* @param {string} localStorageContent - The new localStorageContent.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyLocalStorageChanged(localStorageContent: string) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'local-storage-changed',
|
|
|
|
localStorageContent
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-01-06 14:49:10 +00:00
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) that user updated their hand raised.
|
|
|
|
*
|
|
|
|
* @param {string} id - User id.
|
|
|
|
* @param {boolean} handRaised - Whether user has raised hand.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyRaiseHandUpdated(id: string, handRaised: boolean) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'raise-hand-updated',
|
|
|
|
handRaised,
|
|
|
|
id
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-03-23 16:35:46 +00:00
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) that recording has started or stopped.
|
|
|
|
*
|
|
|
|
* @param {boolean} on - True if recording is on, false otherwise.
|
2022-07-20 15:08:52 +00:00
|
|
|
* @param {string} mode - Stream or file or local.
|
2021-03-23 16:35:46 +00:00
|
|
|
* @param {string} error - Error type or null if success.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyRecordingStatusChanged(on: boolean, mode: string, error?: string) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'recording-status-changed',
|
|
|
|
on,
|
|
|
|
mode,
|
|
|
|
error
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-10-22 08:53:22 +00:00
|
|
|
/**
|
|
|
|
* Notify external application (if API is enabled) that the current recording link is
|
|
|
|
* available.
|
|
|
|
*
|
|
|
|
* @param {string} link - The recording download link.
|
2021-12-06 14:11:16 +00:00
|
|
|
* @param {number} ttl - The recording download link time to live.
|
2021-10-22 08:53:22 +00:00
|
|
|
* @returns {void}
|
|
|
|
*/
|
2021-12-06 14:11:16 +00:00
|
|
|
notifyRecordingLinkAvailable(link: string, ttl: number) {
|
2021-10-22 08:53:22 +00:00
|
|
|
this._sendEvent({
|
|
|
|
name: 'recording-link-available',
|
2021-12-06 14:11:16 +00:00
|
|
|
link,
|
|
|
|
ttl
|
2021-10-22 08:53:22 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-10-21 07:39:13 +00:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-08-25 12:23:40 +00:00
|
|
|
/**
|
2022-07-14 07:10:08 +00:00
|
|
|
* Notify external application (if API is enabled) that an error occurred.
|
2021-08-25 12:23:40 +00:00
|
|
|
*
|
|
|
|
* @param {Object} error - The error.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyError(error: Object) {
|
|
|
|
this._sendEvent({
|
2021-09-02 16:30:18 +00:00
|
|
|
name: 'error-occurred',
|
2021-08-25 12:23:40 +00:00
|
|
|
error
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-09-14 07:07:20 +00:00
|
|
|
/**
|
|
|
|
* Notify external application ( if API is enabled) that a toolbar button was clicked.
|
|
|
|
*
|
|
|
|
* @param {string} key - The key of the toolbar button.
|
2022-01-04 11:21:00 +00:00
|
|
|
* @param {boolean} preventExecution - Whether execution of the button click was prevented or not.
|
2021-09-14 07:07:20 +00:00
|
|
|
* @returns {void}
|
|
|
|
*/
|
2022-01-04 11:21:00 +00:00
|
|
|
notifyToolbarButtonClicked(key: string, preventExecution: boolean) {
|
2021-09-14 07:07:20 +00:00
|
|
|
this._sendEvent({
|
|
|
|
name: 'toolbar-button-clicked',
|
2022-01-04 11:21:00 +00:00
|
|
|
key,
|
|
|
|
preventExecution
|
2021-09-14 07:07:20 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-09-15 12:56:21 +00:00
|
|
|
/**
|
2022-07-14 07:10:08 +00:00
|
|
|
* Notify external application (if API is enabled) whether the used browser is supported or not.
|
2021-09-15 12:56:21 +00:00
|
|
|
*
|
|
|
|
* @param {boolean} supported - If browser is supported or not.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyBrowserSupport(supported: boolean) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'browser-support',
|
|
|
|
supported
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-05-20 10:45:09 +00:00
|
|
|
/**
|
|
|
|
* Notify external application that the breakout rooms changed.
|
|
|
|
*
|
2022-09-09 04:12:56 +00:00
|
|
|
* @param {Array} rooms - Array containing the breakout rooms and main room.
|
2022-05-20 10:45:09 +00:00
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyBreakoutRoomsUpdated(rooms) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'breakout-rooms-updated',
|
|
|
|
rooms
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-06-21 13:23:33 +00:00
|
|
|
/**
|
|
|
|
* Notify the external application that the state of the participants pane changed.
|
|
|
|
*
|
2022-07-14 07:10:08 +00:00
|
|
|
* @param {boolean} open - Whether the panel is open or not.
|
2022-06-21 13:23:33 +00:00
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyParticipantsPaneToggled(open) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'participants-pane-toggled',
|
|
|
|
open
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-08-23 12:17:18 +00:00
|
|
|
/**
|
|
|
|
* Notify the external application that the audio or video is being shared by a participant.
|
|
|
|
*
|
|
|
|
* @param {string} mediaType - Whether the content which is being shared is audio or video.
|
|
|
|
* @param {string} value - Whether the sharing is playing, pause or stop (on audio there is only playing and stop).
|
|
|
|
* @param {string} participantId - Participant id of the participant which started or ended
|
|
|
|
* the video or audio sharing.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyAudioOrVideoSharingToggled(mediaType, value, participantId) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'audio-or-video-sharing-toggled',
|
|
|
|
mediaType,
|
|
|
|
value,
|
|
|
|
participantId
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-11-21 13:32:18 +00:00
|
|
|
/**
|
|
|
|
* Notify the external application that a PeerConnection lost connectivity. This event is fired only if
|
|
|
|
* a PC `failed` but connectivity to the rtcstats server is still maintained signaling that there is a
|
|
|
|
* problem establishing a link between the app and the JVB server or the remote peer in case of P2P.
|
|
|
|
* Will only fire if rtcstats is enabled.
|
|
|
|
*
|
|
|
|
* @param {boolean} isP2P - Type of PC.
|
|
|
|
* @param {boolean} wasConnected - Was this connection previously connected. If it was it could mean
|
|
|
|
* that connectivity was disrupted, if not it most likely means that the app could not reach
|
|
|
|
* the JVB server, or the other peer in case of P2P.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyPeerConnectionFailure(isP2P, wasConnected) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'peer-connection-failure',
|
|
|
|
isP2P,
|
|
|
|
wasConnected
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-02-09 11:12:00 +00:00
|
|
|
/**
|
|
|
|
* Notify external application ( if API is enabled) that a participant menu button was clicked.
|
|
|
|
*
|
|
|
|
* @param {string} key - The key of the participant menu button.
|
|
|
|
* @param {string} participantId - The ID of the participant for with the participant menu button was clicked.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
notifyParticipantMenuButtonClicked(key, participantId) {
|
|
|
|
this._sendEvent({
|
|
|
|
name: 'participant-menu-button-clicked',
|
|
|
|
key,
|
|
|
|
participantId
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2016-12-09 23:15:04 +00:00
|
|
|
/**
|
2017-04-17 15:52:31 +00:00
|
|
|
* Disposes the allocated resources.
|
2017-04-11 18:02:59 +00:00
|
|
|
*
|
|
|
|
* @returns {void}
|
2015-01-09 13:39:32 +00:00
|
|
|
*/
|
2017-04-11 18:02:59 +00:00
|
|
|
dispose() {
|
2017-04-27 20:21:01 +00:00
|
|
|
if (this._enabled) {
|
|
|
|
this._enabled = false;
|
2017-04-06 22:09:55 +00:00
|
|
|
}
|
2015-01-09 13:39:32 +00:00
|
|
|
}
|
2016-12-20 22:15:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default new API();
|