2020-09-25 22:51:54 +00:00
|
|
|
import { jitsiLocalStorage } from '@jitsi/js-utils/jitsi-local-storage';
|
2017-04-03 15:48:46 +00:00
|
|
|
import EventEmitter from 'events';
|
2017-04-18 03:17:23 +00:00
|
|
|
|
2017-09-07 17:21:56 +00:00
|
|
|
import { urlObjectToString } from '../../../react/features/base/util/uri';
|
2017-04-28 20:24:20 +00:00
|
|
|
import {
|
|
|
|
PostMessageTransportBackend,
|
|
|
|
Transport
|
|
|
|
} from '../../transport';
|
2016-06-17 20:35:40 +00:00
|
|
|
|
2019-03-21 12:33:40 +00:00
|
|
|
import {
|
|
|
|
getAvailableDevices,
|
|
|
|
getCurrentDevices,
|
|
|
|
isDeviceChangeAvailable,
|
|
|
|
isDeviceListAvailable,
|
|
|
|
isMultipleAudioInputSupported,
|
|
|
|
setAudioInputDevice,
|
|
|
|
setAudioOutputDevice,
|
|
|
|
setVideoInputDevice
|
|
|
|
} from './functions';
|
2018-06-12 22:40:12 +00:00
|
|
|
|
2017-07-26 20:44:22 +00:00
|
|
|
const ALWAYS_ON_TOP_FILENAMES = [
|
2017-08-04 08:15:11 +00:00
|
|
|
'css/all.css', 'libs/alwaysontop.min.js'
|
2017-07-26 20:44:22 +00:00
|
|
|
];
|
|
|
|
|
2016-06-17 20:35:40 +00:00
|
|
|
/**
|
|
|
|
* Maps the names of the commands expected by the API with the name of the
|
2021-11-04 21:10:43 +00:00
|
|
|
* commands expected by jitsi-meet.
|
2016-06-17 20:35:40 +00:00
|
|
|
*/
|
2017-03-30 21:15:56 +00:00
|
|
|
const commands = {
|
2022-02-04 10:51:33 +00:00
|
|
|
addBreakoutRoom: 'add-breakout-room',
|
2021-10-21 07:39:13 +00:00
|
|
|
answerKnockingParticipant: 'answer-knocking-participant',
|
2021-09-29 13:41:23 +00:00
|
|
|
approveVideo: 'approve-video',
|
|
|
|
askToUnmute: 'ask-to-unmute',
|
2022-02-04 10:51:33 +00:00
|
|
|
autoAssignToBreakoutRooms: 'auto-assign-to-breakout-rooms',
|
2017-04-03 15:48:46 +00:00
|
|
|
avatarUrl: 'avatar-url',
|
2021-01-11 15:21:53 +00:00
|
|
|
cancelPrivateChat: 'cancel-private-chat',
|
2022-02-04 10:51:33 +00:00
|
|
|
closeBreakoutRoom: 'close-breakout-room',
|
2017-04-03 15:48:46 +00:00
|
|
|
displayName: 'display-name',
|
2020-04-16 13:26:45 +00:00
|
|
|
e2eeKey: 'e2ee-key',
|
2017-04-03 15:48:46 +00:00
|
|
|
email: 'email',
|
2022-03-23 09:31:44 +00:00
|
|
|
grantModerator: 'grant-moderator',
|
2017-04-03 15:48:46 +00:00
|
|
|
hangup: 'video-hangup',
|
2021-04-30 13:36:32 +00:00
|
|
|
initiatePrivateChat: 'initiate-private-chat',
|
2022-02-04 10:51:33 +00:00
|
|
|
joinBreakoutRoom: 'join-breakout-room',
|
2021-12-17 07:38:15 +00:00
|
|
|
localSubject: 'local-subject',
|
2021-02-11 09:04:36 +00:00
|
|
|
kickParticipant: 'kick-participant',
|
2020-05-19 06:50:21 +00:00
|
|
|
muteEveryone: 'mute-everyone',
|
2021-03-10 15:39:35 +00:00
|
|
|
overwriteConfig: 'overwrite-config',
|
2019-06-08 17:35:11 +00:00
|
|
|
password: 'password',
|
2020-09-22 16:25:13 +00:00
|
|
|
pinParticipant: 'pin-participant',
|
2021-09-29 13:41:23 +00:00
|
|
|
rejectParticipant: 'reject-participant',
|
2022-02-04 10:51:33 +00:00
|
|
|
removeBreakoutRoom: 'remove-breakout-room',
|
2020-09-16 23:16:32 +00:00
|
|
|
resizeLargeVideo: 'resize-large-video',
|
2021-06-24 09:37:26 +00:00
|
|
|
sendChatMessage: 'send-chat-message',
|
2020-03-20 11:51:26 +00:00
|
|
|
sendEndpointTextMessage: 'send-endpoint-text-message',
|
2022-02-04 10:51:33 +00:00
|
|
|
sendParticipantToRoom: 'send-participant-to-room',
|
2019-08-30 21:17:22 +00:00
|
|
|
sendTones: 'send-tones',
|
2021-07-06 11:37:31 +00:00
|
|
|
setFollowMe: 'set-follow-me',
|
2020-09-14 20:01:46 +00:00
|
|
|
setLargeVideoParticipant: 'set-large-video-participant',
|
2021-11-16 11:12:10 +00:00
|
|
|
setMediaEncryptionKey: 'set-media-encryption-key',
|
2021-06-02 20:28:39 +00:00
|
|
|
setParticipantVolume: 'set-participant-volume',
|
2022-04-20 08:43:18 +00:00
|
|
|
setSubtitles: 'set-subtitles',
|
2021-03-23 12:18:39 +00:00
|
|
|
setTileView: 'set-tile-view',
|
2020-05-07 18:26:10 +00:00
|
|
|
setVideoQuality: 'set-video-quality',
|
2020-05-22 19:24:56 +00:00
|
|
|
startRecording: 'start-recording',
|
2021-04-16 09:43:34 +00:00
|
|
|
startShareVideo: 'start-share-video',
|
2020-05-22 19:24:56 +00:00
|
|
|
stopRecording: 'stop-recording',
|
2021-04-16 09:43:34 +00:00
|
|
|
stopShareVideo: 'stop-share-video',
|
2019-02-17 14:40:24 +00:00
|
|
|
subject: 'subject',
|
2018-01-19 22:19:55 +00:00
|
|
|
submitFeedback: 'submit-feedback',
|
2017-04-03 15:48:46 +00:00
|
|
|
toggleAudio: 'toggle-audio',
|
2021-03-25 11:48:49 +00:00
|
|
|
toggleCamera: 'toggle-camera',
|
2021-03-25 12:57:41 +00:00
|
|
|
toggleCameraMirror: 'toggle-camera-mirror',
|
2017-04-03 15:48:46 +00:00
|
|
|
toggleChat: 'toggle-chat',
|
2021-11-16 11:12:10 +00:00
|
|
|
toggleE2EE: 'toggle-e2ee',
|
2017-04-03 15:48:46 +00:00
|
|
|
toggleFilmStrip: 'toggle-film-strip',
|
2022-03-23 09:31:44 +00:00
|
|
|
toggleLobby: 'toggle-lobby',
|
2021-09-29 13:41:23 +00:00
|
|
|
toggleModeration: 'toggle-moderation',
|
2022-02-01 10:45:54 +00:00
|
|
|
toggleParticipantsPane: 'toggle-participants-pane',
|
2021-03-22 16:22:45 +00:00
|
|
|
toggleRaiseHand: 'toggle-raise-hand',
|
2021-07-07 08:07:30 +00:00
|
|
|
toggleShareAudio: 'toggle-share-audio',
|
2017-04-03 15:48:46 +00:00
|
|
|
toggleShareScreen: 'toggle-share-screen',
|
2022-04-20 08:43:18 +00:00
|
|
|
toggleSubtitles: 'toggle-subtitles',
|
2019-05-18 20:40:58 +00:00
|
|
|
toggleTileView: 'toggle-tile-view',
|
2021-05-27 07:57:59 +00:00
|
|
|
toggleVirtualBackgroundDialog: 'toggle-virtual-background',
|
2017-04-03 15:48:46 +00:00
|
|
|
toggleVideo: 'toggle-video'
|
2016-06-17 20:35:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps the names of the events expected by the API with the name of the
|
2021-11-04 21:10:43 +00:00
|
|
|
* events expected by jitsi-meet.
|
2016-06-17 20:35:40 +00:00
|
|
|
*/
|
2017-03-30 21:15:56 +00:00
|
|
|
const events = {
|
2017-12-05 03:27:17 +00:00
|
|
|
'avatar-changed': 'avatarChanged',
|
2017-08-04 08:15:11 +00:00
|
|
|
'audio-availability-changed': 'audioAvailabilityChanged',
|
|
|
|
'audio-mute-status-changed': 'audioMuteStatusChanged',
|
2021-09-15 12:56:21 +00:00
|
|
|
'browser-support': 'browserSupport',
|
2019-05-29 21:17:07 +00:00
|
|
|
'camera-error': 'cameraError',
|
2021-01-28 09:39:17 +00:00
|
|
|
'chat-updated': 'chatUpdated',
|
2021-01-12 09:13:20 +00:00
|
|
|
'content-sharing-participants-changed': 'contentSharingParticipantsChanged',
|
2021-09-30 09:57:17 +00:00
|
|
|
'data-channel-opened': 'dataChannelOpened',
|
2019-03-28 12:21:38 +00:00
|
|
|
'device-list-changed': 'deviceListChanged',
|
2017-04-18 03:17:23 +00:00
|
|
|
'display-name-change': 'displayNameChange',
|
2018-06-18 09:19:07 +00:00
|
|
|
'email-change': 'emailChange',
|
2021-09-02 16:30:18 +00:00
|
|
|
'error-occurred': 'errorOccurred',
|
2020-03-20 11:51:26 +00:00
|
|
|
'endpoint-text-message-received': 'endpointTextMessageReceived',
|
2022-04-08 07:12:38 +00:00
|
|
|
'face-landmark-detected': 'faceLandmarkDetected',
|
2018-01-19 22:19:55 +00:00
|
|
|
'feedback-submitted': 'feedbackSubmitted',
|
2019-02-19 22:18:49 +00:00
|
|
|
'feedback-prompt-displayed': 'feedbackPromptDisplayed',
|
2019-03-11 18:17:28 +00:00
|
|
|
'filmstrip-display-changed': 'filmstripDisplayChanged',
|
2017-04-18 03:17:23 +00:00
|
|
|
'incoming-message': 'incomingMessage',
|
2021-10-21 07:39:13 +00:00
|
|
|
'knocking-participant': 'knockingParticipant',
|
2020-07-28 07:39:54 +00:00
|
|
|
'log': 'log',
|
2019-05-29 21:17:07 +00:00
|
|
|
'mic-error': 'micError',
|
2021-09-29 13:41:23 +00:00
|
|
|
'moderation-participant-approved': 'moderationParticipantApproved',
|
|
|
|
'moderation-participant-rejected': 'moderationParticipantRejected',
|
|
|
|
'moderation-status-changed': 'moderationStatusChanged',
|
2021-06-09 10:09:08 +00:00
|
|
|
'mouse-enter': 'mouseEnter',
|
|
|
|
'mouse-leave': 'mouseLeave',
|
|
|
|
'mouse-move': 'mouseMove',
|
2017-04-18 03:17:23 +00:00
|
|
|
'outgoing-message': 'outgoingMessage',
|
|
|
|
'participant-joined': 'participantJoined',
|
2019-06-28 22:22:43 +00:00
|
|
|
'participant-kicked-out': 'participantKickedOut',
|
2017-04-18 03:17:23 +00:00
|
|
|
'participant-left': 'participantLeft',
|
2020-05-05 14:03:54 +00:00
|
|
|
'participant-role-changed': 'participantRoleChanged',
|
2019-06-08 17:35:11 +00:00
|
|
|
'password-required': 'passwordRequired',
|
2019-01-26 20:53:11 +00:00
|
|
|
'proxy-connection-event': 'proxyConnectionEvent',
|
2021-01-06 14:49:10 +00:00
|
|
|
'raise-hand-updated': 'raiseHandUpdated',
|
2021-10-22 08:53:22 +00:00
|
|
|
'recording-link-available': 'recordingLinkAvailable',
|
2021-03-23 16:35:46 +00:00
|
|
|
'recording-status-changed': 'recordingStatusChanged',
|
2017-04-18 03:17:23 +00:00
|
|
|
'video-ready-to-close': 'readyToClose',
|
|
|
|
'video-conference-joined': 'videoConferenceJoined',
|
2017-08-04 08:15:11 +00:00
|
|
|
'video-conference-left': 'videoConferenceLeft',
|
|
|
|
'video-availability-changed': 'videoAvailabilityChanged',
|
2018-01-30 13:43:06 +00:00
|
|
|
'video-mute-status-changed': 'videoMuteStatusChanged',
|
2020-09-03 22:40:54 +00:00
|
|
|
'video-quality-changed': 'videoQualityChanged',
|
2019-02-17 14:40:24 +00:00
|
|
|
'screen-sharing-status-changed': 'screenSharingStatusChanged',
|
2019-08-09 08:09:33 +00:00
|
|
|
'dominant-speaker-changed': 'dominantSpeakerChanged',
|
2019-05-18 20:40:58 +00:00
|
|
|
'subject-change': 'subjectChange',
|
2019-06-26 14:20:51 +00:00
|
|
|
'suspend-detected': 'suspendDetected',
|
2021-09-14 07:07:20 +00:00
|
|
|
'tile-view-changed': 'tileViewChanged',
|
|
|
|
'toolbar-button-clicked': 'toolbarButtonClicked'
|
2016-06-17 20:35:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2021-11-04 21:10:43 +00:00
|
|
|
* Last id of api object.
|
|
|
|
*
|
2017-04-03 15:48:46 +00:00
|
|
|
* @type {number}
|
2016-06-17 20:35:40 +00:00
|
|
|
*/
|
2017-04-03 15:48:46 +00:00
|
|
|
let id = 0;
|
|
|
|
|
2017-01-18 19:20:32 +00:00
|
|
|
/**
|
|
|
|
* Adds given number to the numberOfParticipants property of given APIInstance.
|
2017-04-03 15:48:46 +00:00
|
|
|
*
|
|
|
|
* @param {JitsiMeetExternalAPI} APIInstance - The instance of the API.
|
|
|
|
* @param {int} number - The number of participants to be added to
|
2017-01-18 19:20:32 +00:00
|
|
|
* numberOfParticipants property (this parameter can be negative number if the
|
|
|
|
* numberOfParticipants should be decreased).
|
2017-04-03 15:48:46 +00:00
|
|
|
* @returns {void}
|
2017-01-18 19:20:32 +00:00
|
|
|
*/
|
|
|
|
function changeParticipantNumber(APIInstance, number) {
|
2017-07-13 18:20:00 +00:00
|
|
|
APIInstance._numberOfParticipants += number;
|
2017-01-18 19:20:32 +00:00
|
|
|
}
|
|
|
|
|
2017-04-03 15:48:46 +00:00
|
|
|
/**
|
|
|
|
* Generates the URL for the iframe.
|
|
|
|
*
|
|
|
|
* @param {string} domain - The domain name of the server that hosts the
|
|
|
|
* conference.
|
|
|
|
* @param {string} [options] - Another optional parameters.
|
|
|
|
* @param {Object} [options.configOverwrite] - Object containing configuration
|
|
|
|
* options defined in config.js to be overridden.
|
|
|
|
* @param {Object} [options.interfaceConfigOverwrite] - Object containing
|
|
|
|
* configuration options defined in interface_config.js to be overridden.
|
|
|
|
* @param {string} [options.jwt] - The JWT token if needed by jitsi-meet for
|
|
|
|
* authentication.
|
2022-03-08 14:57:53 +00:00
|
|
|
* @param {string} [options.lang] - The meeting's default language.
|
2017-04-03 15:48:46 +00:00
|
|
|
* @param {string} [options.roomName] - The name of the room to join.
|
|
|
|
* @returns {string} The URL.
|
|
|
|
*/
|
|
|
|
function generateURL(domain, options = {}) {
|
2017-07-27 18:50:09 +00:00
|
|
|
return urlObjectToString({
|
|
|
|
...options,
|
2020-11-10 12:29:01 +00:00
|
|
|
url: `https://${domain}/#jitsi_meet_external_api_id=${id}`
|
2017-07-27 18:50:09 +00:00
|
|
|
});
|
2017-04-03 15:48:46 +00:00
|
|
|
}
|
|
|
|
|
2017-07-13 19:23:54 +00:00
|
|
|
/**
|
|
|
|
* Parses the arguments passed to the constructor. If the old format is used
|
|
|
|
* the function translates the arguments to the new format.
|
|
|
|
*
|
|
|
|
* @param {Array} args - The arguments to be parsed.
|
|
|
|
* @returns {Object} JS object with properties.
|
|
|
|
*/
|
|
|
|
function parseArguments(args) {
|
|
|
|
if (!args.length) {
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
|
|
|
const firstArg = args[0];
|
|
|
|
|
|
|
|
switch (typeof firstArg) {
|
|
|
|
case 'string': // old arguments format
|
2021-08-06 07:51:54 +00:00
|
|
|
case 'undefined': {
|
2018-10-02 13:03:23 +00:00
|
|
|
// Not sure which format but we are trying to parse the old
|
|
|
|
// format because if the new format is used everything will be undefined
|
|
|
|
// anyway.
|
2017-07-13 19:23:54 +00:00
|
|
|
const [
|
|
|
|
roomName,
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
parentNode,
|
|
|
|
configOverwrite,
|
|
|
|
interfaceConfigOverwrite,
|
2018-01-22 23:47:18 +00:00
|
|
|
jwt,
|
2022-03-08 14:57:53 +00:00
|
|
|
onload,
|
|
|
|
lang
|
2017-07-13 19:23:54 +00:00
|
|
|
] = args;
|
|
|
|
|
|
|
|
return {
|
|
|
|
roomName,
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
parentNode,
|
|
|
|
configOverwrite,
|
|
|
|
interfaceConfigOverwrite,
|
2018-01-22 23:47:18 +00:00
|
|
|
jwt,
|
2022-03-08 14:57:53 +00:00
|
|
|
onload,
|
|
|
|
lang
|
2017-07-13 19:23:54 +00:00
|
|
|
};
|
2018-10-02 13:03:23 +00:00
|
|
|
}
|
2017-07-13 19:23:54 +00:00
|
|
|
case 'object': // new arguments format
|
|
|
|
return args[0];
|
|
|
|
default:
|
|
|
|
throw new Error('Can\'t parse the arguments!');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-13 20:24:44 +00:00
|
|
|
/**
|
|
|
|
* Compute valid values for height and width. If a number is specified it's
|
|
|
|
* treated as pixel units. If the value is expressed in px, em, pt or
|
|
|
|
* percentage, it's used as is.
|
|
|
|
*
|
|
|
|
* @param {any} value - The value to be parsed.
|
|
|
|
* @returns {string|undefined} The parsed value that can be used for setting
|
|
|
|
* sizes through the style property. If invalid value is passed the method
|
2021-03-16 14:56:54 +00:00
|
|
|
* returns undefined.
|
2017-07-13 20:24:44 +00:00
|
|
|
*/
|
|
|
|
function parseSizeParam(value) {
|
|
|
|
let parsedValue;
|
|
|
|
|
|
|
|
// This regex parses values of the form 100px, 100em, 100pt or 100%.
|
|
|
|
// Values like 100 or 100px are handled outside of the regex, and
|
|
|
|
// invalid values will be ignored and the minimum will be used.
|
|
|
|
const re = /([0-9]*\.?[0-9]+)(em|pt|px|%)$/;
|
|
|
|
|
|
|
|
if (typeof value === 'string' && String(value).match(re) !== null) {
|
|
|
|
parsedValue = value;
|
|
|
|
} else if (typeof value === 'number') {
|
|
|
|
parsedValue = `${value}px`;
|
|
|
|
}
|
|
|
|
|
|
|
|
return parsedValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-06-17 20:35:40 +00:00
|
|
|
/**
|
2017-03-30 21:15:56 +00:00
|
|
|
* The IFrame API interface class.
|
2016-06-17 20:35:40 +00:00
|
|
|
*/
|
2017-06-14 18:13:41 +00:00
|
|
|
export default class JitsiMeetExternalAPI extends EventEmitter {
|
2017-03-30 21:15:56 +00:00
|
|
|
/**
|
2017-04-03 15:48:46 +00:00
|
|
|
* Constructs new API instance. Creates iframe and loads Jitsi Meet in it.
|
|
|
|
*
|
|
|
|
* @param {string} domain - The domain name of the server that hosts the
|
|
|
|
* conference.
|
2017-07-13 19:23:54 +00:00
|
|
|
* @param {Object} [options] - Optional arguments.
|
|
|
|
* @param {string} [options.roomName] - The name of the room to join.
|
2017-07-13 20:24:44 +00:00
|
|
|
* @param {number|string} [options.width] - Width of the iframe. Check
|
|
|
|
* parseSizeParam for format details.
|
|
|
|
* @param {number|string} [options.height] - Height of the iframe. Check
|
|
|
|
* parseSizeParam for format details.
|
2017-07-13 19:23:54 +00:00
|
|
|
* @param {DOMElement} [options.parentNode] - The node that will contain the
|
2017-04-03 15:48:46 +00:00
|
|
|
* iframe.
|
2017-07-13 19:23:54 +00:00
|
|
|
* @param {Object} [options.configOverwrite] - Object containing
|
|
|
|
* configuration options defined in config.js to be overridden.
|
|
|
|
* @param {Object} [options.interfaceConfigOverwrite] - Object containing
|
2017-04-03 15:48:46 +00:00
|
|
|
* configuration options defined in interface_config.js to be overridden.
|
2017-07-13 19:23:54 +00:00
|
|
|
* @param {string} [options.jwt] - The JWT token if needed by jitsi-meet for
|
2017-03-30 21:15:56 +00:00
|
|
|
* authentication.
|
2022-03-08 14:57:53 +00:00
|
|
|
* @param {string} [options.lang] - The meeting's default language.
|
2018-01-22 23:47:18 +00:00
|
|
|
* @param {string} [options.onload] - The onload function that will listen
|
|
|
|
* for iframe onload event.
|
2018-04-30 12:08:11 +00:00
|
|
|
* @param {Array<Object>} [options.invitees] - Array of objects containing
|
|
|
|
* information about new participants that will be invited in the call.
|
2019-03-25 11:33:41 +00:00
|
|
|
* @param {Array<Object>} [options.devices] - Array of objects containing
|
|
|
|
* information about the initial devices that will be used in the call.
|
2019-11-12 13:37:54 +00:00
|
|
|
* @param {Object} [options.userInfo] - Object containing information about
|
|
|
|
* the participant opening the meeting.
|
2020-04-16 13:26:45 +00:00
|
|
|
* @param {string} [options.e2eeKey] - The key used for End-to-End encryption.
|
|
|
|
* THIS IS EXPERIMENTAL.
|
2017-03-30 21:15:56 +00:00
|
|
|
*/
|
2017-07-13 19:23:54 +00:00
|
|
|
constructor(domain, ...args) {
|
2017-03-31 16:38:44 +00:00
|
|
|
super();
|
2017-07-13 19:23:54 +00:00
|
|
|
const {
|
|
|
|
roomName = '',
|
2017-07-13 20:24:44 +00:00
|
|
|
width = '100%',
|
|
|
|
height = '100%',
|
2017-07-13 19:23:54 +00:00
|
|
|
parentNode = document.body,
|
|
|
|
configOverwrite = {},
|
|
|
|
interfaceConfigOverwrite = {},
|
2018-01-22 23:47:18 +00:00
|
|
|
jwt = undefined,
|
2022-03-08 14:57:53 +00:00
|
|
|
lang = undefined,
|
2018-04-30 12:08:11 +00:00
|
|
|
onload = undefined,
|
2019-03-25 11:33:41 +00:00
|
|
|
invitees,
|
2019-11-12 13:37:54 +00:00
|
|
|
devices,
|
2020-04-16 13:26:45 +00:00
|
|
|
userInfo,
|
|
|
|
e2eeKey
|
2017-07-13 19:23:54 +00:00
|
|
|
} = parseArguments(args);
|
2020-09-25 22:51:54 +00:00
|
|
|
const localStorageContent = jitsiLocalStorage.getItem('jitsiLocalStorage');
|
2017-07-13 19:23:54 +00:00
|
|
|
|
2017-07-13 18:20:00 +00:00
|
|
|
this._parentNode = parentNode;
|
|
|
|
this._url = generateURL(domain, {
|
2017-04-03 15:48:46 +00:00
|
|
|
configOverwrite,
|
|
|
|
interfaceConfigOverwrite,
|
|
|
|
jwt,
|
2022-03-08 14:57:53 +00:00
|
|
|
lang,
|
2019-03-25 11:33:41 +00:00
|
|
|
roomName,
|
2019-11-12 13:37:54 +00:00
|
|
|
devices,
|
2020-09-25 22:51:54 +00:00
|
|
|
userInfo,
|
|
|
|
appData: {
|
|
|
|
localStorageContent
|
|
|
|
}
|
2017-04-03 15:48:46 +00:00
|
|
|
});
|
2018-01-22 23:47:18 +00:00
|
|
|
this._createIFrame(height, width, onload);
|
2017-04-18 03:17:23 +00:00
|
|
|
this._transport = new Transport({
|
2017-04-28 20:24:20 +00:00
|
|
|
backend: new PostMessageTransportBackend({
|
2017-04-18 03:17:23 +00:00
|
|
|
postisOptions: {
|
2020-07-24 10:24:44 +00:00
|
|
|
allowedOrigin: new URL(this._url).origin,
|
2017-04-18 03:17:23 +00:00
|
|
|
scope: `jitsi_meet_external_api_${id}`,
|
2017-07-13 18:20:00 +00:00
|
|
|
window: this._frame.contentWindow
|
2017-04-18 03:17:23 +00:00
|
|
|
}
|
|
|
|
})
|
2017-04-03 15:48:46 +00:00
|
|
|
});
|
2018-08-03 17:06:06 +00:00
|
|
|
if (Array.isArray(invitees) && invitees.length > 0) {
|
|
|
|
this.invite(invitees);
|
|
|
|
}
|
2020-04-16 13:26:45 +00:00
|
|
|
this._tmpE2EEKey = e2eeKey;
|
2017-12-05 03:27:17 +00:00
|
|
|
this._isLargeVideoVisible = true;
|
|
|
|
this._numberOfParticipants = 0;
|
|
|
|
this._participants = {};
|
|
|
|
this._myUserID = undefined;
|
|
|
|
this._onStageParticipant = undefined;
|
2017-04-03 15:48:46 +00:00
|
|
|
this._setupListeners();
|
|
|
|
id++;
|
|
|
|
}
|
2017-03-31 16:38:44 +00:00
|
|
|
|
2017-04-03 15:48:46 +00:00
|
|
|
/**
|
|
|
|
* Creates the iframe element.
|
|
|
|
*
|
2017-07-13 20:24:44 +00:00
|
|
|
* @param {number|string} height - The height of the iframe. Check
|
|
|
|
* parseSizeParam for format details.
|
|
|
|
* @param {number|string} width - The with of the iframe. Check
|
|
|
|
* parseSizeParam for format details.
|
2018-01-22 23:47:18 +00:00
|
|
|
* @param {Function} onload - The function that will listen
|
|
|
|
* for onload event.
|
2017-04-03 15:48:46 +00:00
|
|
|
* @returns {void}
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
*/
|
2018-01-22 23:47:18 +00:00
|
|
|
_createIFrame(height, width, onload) {
|
2017-07-13 18:20:00 +00:00
|
|
|
const frameName = `jitsiConferenceFrame${id}`;
|
|
|
|
|
|
|
|
this._frame = document.createElement('iframe');
|
2021-02-26 19:17:01 +00:00
|
|
|
this._frame.allow = 'camera; microphone; display-capture; autoplay; clipboard-write';
|
2017-07-13 18:20:00 +00:00
|
|
|
this._frame.src = this._url;
|
|
|
|
this._frame.name = frameName;
|
|
|
|
this._frame.id = frameName;
|
2017-07-13 20:24:44 +00:00
|
|
|
this._setSize(height, width);
|
2017-07-13 18:20:00 +00:00
|
|
|
this._frame.setAttribute('allowFullScreen', 'true');
|
|
|
|
this._frame.style.border = 0;
|
2018-01-22 23:47:18 +00:00
|
|
|
|
|
|
|
if (onload) {
|
|
|
|
// waits for iframe resources to load
|
|
|
|
// and fires event when it is done
|
|
|
|
this._frame.onload = onload;
|
|
|
|
}
|
|
|
|
|
2017-07-13 18:23:32 +00:00
|
|
|
this._frame = this._parentNode.appendChild(this._frame);
|
2016-06-17 20:35:40 +00:00
|
|
|
}
|
|
|
|
|
2017-07-26 20:44:22 +00:00
|
|
|
/**
|
|
|
|
* Returns arrays with the all resources for the always on top feature.
|
|
|
|
*
|
|
|
|
* @returns {Array<string>}
|
|
|
|
*/
|
|
|
|
_getAlwaysOnTopResources() {
|
2017-11-13 22:29:38 +00:00
|
|
|
const iframeWindow = this._frame.contentWindow;
|
|
|
|
const iframeDocument = iframeWindow.document;
|
|
|
|
let baseURL = '';
|
|
|
|
const base = iframeDocument.querySelector('base');
|
|
|
|
|
|
|
|
if (base && base.href) {
|
|
|
|
baseURL = base.href;
|
|
|
|
} else {
|
|
|
|
const { protocol, host } = iframeWindow.location;
|
|
|
|
|
|
|
|
baseURL = `${protocol}//${host}`;
|
|
|
|
}
|
|
|
|
|
2017-07-26 20:44:22 +00:00
|
|
|
return ALWAYS_ON_TOP_FILENAMES.map(
|
2021-11-04 21:10:43 +00:00
|
|
|
filename => new URL(filename, baseURL).href
|
2017-07-26 20:44:22 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-09-16 18:43:44 +00:00
|
|
|
/**
|
|
|
|
* Returns the formatted display name of a participant.
|
|
|
|
*
|
|
|
|
* @param {string} participantId - The id of the participant.
|
|
|
|
* @returns {string} The formatted display name.
|
|
|
|
*/
|
|
|
|
_getFormattedDisplayName(participantId) {
|
|
|
|
const { formattedDisplayName }
|
|
|
|
= this._participants[participantId] || {};
|
|
|
|
|
|
|
|
return formattedDisplayName;
|
|
|
|
}
|
|
|
|
|
2017-12-05 03:27:17 +00:00
|
|
|
/**
|
|
|
|
* Returns the id of the on stage participant.
|
|
|
|
*
|
|
|
|
* @returns {string} - The id of the on stage participant.
|
|
|
|
*/
|
|
|
|
_getOnStageParticipant() {
|
|
|
|
return this._onStageParticipant;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Getter for the large video element in Jitsi Meet.
|
|
|
|
*
|
|
|
|
* @returns {HTMLElement|undefined} - The large video.
|
|
|
|
*/
|
|
|
|
_getLargeVideo() {
|
|
|
|
const iframe = this.getIFrame();
|
|
|
|
|
|
|
|
if (!this._isLargeVideoVisible
|
|
|
|
|| !iframe
|
|
|
|
|| !iframe.contentWindow
|
|
|
|
|| !iframe.contentWindow.document) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
return iframe.contentWindow.document.getElementById('largeVideo');
|
|
|
|
}
|
|
|
|
|
2019-08-23 15:35:10 +00:00
|
|
|
/**
|
|
|
|
* Getter for participant specific video element in Jitsi Meet.
|
|
|
|
*
|
|
|
|
* @param {string|undefined} participantId - Id of participant to return the video for.
|
|
|
|
*
|
|
|
|
* @returns {HTMLElement|undefined} - The requested video. Will return the local video
|
|
|
|
* by default if participantId is undefined.
|
|
|
|
*/
|
|
|
|
_getParticipantVideo(participantId) {
|
|
|
|
const iframe = this.getIFrame();
|
|
|
|
|
|
|
|
if (!iframe
|
|
|
|
|| !iframe.contentWindow
|
|
|
|
|| !iframe.contentWindow.document) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (typeof participantId === 'undefined' || participantId === this._myUserID) {
|
|
|
|
return iframe.contentWindow.document.getElementById('localVideo_container');
|
|
|
|
}
|
|
|
|
|
|
|
|
return iframe.contentWindow.document.querySelector(`#participant_${participantId} video`);
|
|
|
|
}
|
|
|
|
|
2017-07-13 20:24:44 +00:00
|
|
|
/**
|
|
|
|
* Sets the size of the iframe element.
|
|
|
|
*
|
|
|
|
* @param {number|string} height - The height of the iframe.
|
|
|
|
* @param {number|string} width - The with of the iframe.
|
|
|
|
* @returns {void}
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
_setSize(height, width) {
|
|
|
|
const parsedHeight = parseSizeParam(height);
|
|
|
|
const parsedWidth = parseSizeParam(width);
|
|
|
|
|
|
|
|
if (parsedHeight !== undefined) {
|
2020-09-16 23:16:32 +00:00
|
|
|
this._height = height;
|
2017-07-13 20:24:44 +00:00
|
|
|
this._frame.style.height = parsedHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (parsedWidth !== undefined) {
|
2020-09-16 23:16:32 +00:00
|
|
|
this._width = width;
|
2017-07-13 20:24:44 +00:00
|
|
|
this._frame.style.width = parsedWidth;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-30 21:15:56 +00:00
|
|
|
/**
|
2017-04-03 15:48:46 +00:00
|
|
|
* Setups listeners that are used internally for JitsiMeetExternalAPI.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*
|
|
|
|
* @private
|
2017-03-30 21:15:56 +00:00
|
|
|
*/
|
2017-04-03 15:48:46 +00:00
|
|
|
_setupListeners() {
|
2017-05-01 20:59:18 +00:00
|
|
|
this._transport.on('event', ({ name, ...data }) => {
|
2017-12-05 03:27:17 +00:00
|
|
|
const userID = data.id;
|
|
|
|
|
|
|
|
switch (name) {
|
2020-04-16 13:26:45 +00:00
|
|
|
case 'video-conference-joined': {
|
|
|
|
if (typeof this._tmpE2EEKey !== 'undefined') {
|
|
|
|
this.executeCommand(commands.e2eeKey, this._tmpE2EEKey);
|
|
|
|
this._tmpE2EEKey = undefined;
|
|
|
|
}
|
|
|
|
|
2017-12-05 03:27:17 +00:00
|
|
|
this._myUserID = userID;
|
|
|
|
this._participants[userID] = {
|
|
|
|
avatarURL: data.avatarURL
|
|
|
|
};
|
2020-04-16 13:26:45 +00:00
|
|
|
}
|
2017-12-05 03:27:17 +00:00
|
|
|
|
|
|
|
// eslint-disable-next-line no-fallthrough
|
|
|
|
case 'participant-joined': {
|
|
|
|
this._participants[userID] = this._participants[userID] || {};
|
|
|
|
this._participants[userID].displayName = data.displayName;
|
|
|
|
this._participants[userID].formattedDisplayName
|
|
|
|
= data.formattedDisplayName;
|
2017-04-18 03:17:23 +00:00
|
|
|
changeParticipantNumber(this, 1);
|
2017-12-05 03:27:17 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'participant-left':
|
2017-04-18 03:17:23 +00:00
|
|
|
changeParticipantNumber(this, -1);
|
2017-12-05 03:27:17 +00:00
|
|
|
delete this._participants[userID];
|
|
|
|
break;
|
|
|
|
case 'display-name-change': {
|
|
|
|
const user = this._participants[userID];
|
|
|
|
|
|
|
|
if (user) {
|
|
|
|
user.displayName = data.displayname;
|
|
|
|
user.formattedDisplayName = data.formattedDisplayName;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2018-06-18 09:19:07 +00:00
|
|
|
case 'email-change': {
|
|
|
|
const user = this._participants[userID];
|
|
|
|
|
|
|
|
if (user) {
|
|
|
|
user.email = data.email;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2017-12-05 03:27:17 +00:00
|
|
|
case 'avatar-changed': {
|
|
|
|
const user = this._participants[userID];
|
|
|
|
|
|
|
|
if (user) {
|
|
|
|
user.avatarURL = data.avatarURL;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'on-stage-participant-changed':
|
|
|
|
this._onStageParticipant = userID;
|
|
|
|
this.emit('largeVideoChanged');
|
|
|
|
break;
|
|
|
|
case 'large-video-visibility-changed':
|
|
|
|
this._isLargeVideoVisible = data.isVisible;
|
|
|
|
this.emit('largeVideoChanged');
|
|
|
|
break;
|
|
|
|
case 'video-conference-left':
|
|
|
|
changeParticipantNumber(this, -1);
|
|
|
|
delete this._participants[this._myUserID];
|
|
|
|
break;
|
2020-09-03 22:40:54 +00:00
|
|
|
case 'video-quality-changed':
|
|
|
|
this._videoQuality = data.videoQuality;
|
|
|
|
break;
|
2020-09-25 22:51:54 +00:00
|
|
|
case 'local-storage-changed':
|
|
|
|
jitsiLocalStorage.setItem('jitsiLocalStorage', data.localStorageContent);
|
|
|
|
|
|
|
|
// Since this is internal event we don't need to emit it to the consumer of the API.
|
|
|
|
return true;
|
2017-04-18 03:17:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const eventName = events[name];
|
|
|
|
|
|
|
|
if (eventName) {
|
|
|
|
this.emit(eventName, data);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
});
|
2017-03-30 21:15:56 +00:00
|
|
|
}
|
2016-06-17 20:35:40 +00:00
|
|
|
|
2017-03-30 21:15:56 +00:00
|
|
|
/**
|
2017-04-03 15:48:46 +00:00
|
|
|
* Adds event listener to Meet Jitsi.
|
|
|
|
*
|
|
|
|
* @param {string} event - The name of the event.
|
|
|
|
* @param {Function} listener - The listener.
|
|
|
|
* @returns {void}
|
|
|
|
*
|
|
|
|
* @deprecated
|
|
|
|
* NOTE: This method is not removed for backward comatability purposes.
|
2017-03-30 21:15:56 +00:00
|
|
|
*/
|
2017-04-03 15:48:46 +00:00
|
|
|
addEventListener(event, listener) {
|
|
|
|
this.on(event, listener);
|
2017-03-30 21:15:56 +00:00
|
|
|
}
|
2016-06-17 20:35:40 +00:00
|
|
|
|
2017-03-30 21:15:56 +00:00
|
|
|
/**
|
2017-04-03 15:48:46 +00:00
|
|
|
* Adds event listeners to Meet Jitsi.
|
|
|
|
*
|
|
|
|
* @param {Object} listeners - The object key should be the name of
|
2017-03-30 21:15:56 +00:00
|
|
|
* the event and value - the listener.
|
|
|
|
* Currently we support the following
|
|
|
|
* events:
|
2020-07-28 07:39:54 +00:00
|
|
|
* {@code log} - receives event notifications whenever information has
|
|
|
|
* been logged and has a log level specified within {@code config.apiLogLevels}.
|
|
|
|
* The listener will receive object with the following structure:
|
|
|
|
* {{
|
|
|
|
* logLevel: the message log level
|
|
|
|
* arguments: an array of strings that compose the actual log message
|
|
|
|
* }}
|
2021-01-28 09:39:17 +00:00
|
|
|
* {@code chatUpdated} - receives event notifications about chat state being
|
|
|
|
* updated. The listener will receive object with the following structure:
|
|
|
|
* {{
|
|
|
|
* 'unreadCount': unreadCounter, // the unread message(s) counter,
|
|
|
|
* 'isOpen': isOpen, // whether the chat panel is open or not
|
|
|
|
* }}
|
2018-11-08 12:25:02 +00:00
|
|
|
* {@code incomingMessage} - receives event notifications about incoming
|
2017-03-30 21:15:56 +00:00
|
|
|
* messages. The listener will receive object with the following structure:
|
|
|
|
* {{
|
2017-04-03 15:48:46 +00:00
|
|
|
* 'from': from,//JID of the user that sent the message
|
|
|
|
* 'nick': nick,//the nickname of the user that sent the message
|
|
|
|
* 'message': txt//the text of the message
|
2017-03-30 21:15:56 +00:00
|
|
|
* }}
|
2018-11-08 12:25:02 +00:00
|
|
|
* {@code outgoingMessage} - receives event notifications about outgoing
|
2017-03-30 21:15:56 +00:00
|
|
|
* messages. The listener will receive object with the following structure:
|
|
|
|
* {{
|
2017-04-03 15:48:46 +00:00
|
|
|
* 'message': txt//the text of the message
|
2017-03-30 21:15:56 +00:00
|
|
|
* }}
|
2018-11-08 12:25:02 +00:00
|
|
|
* {@code displayNameChanged} - receives event notifications about display
|
|
|
|
* name change. The listener will receive object with the following
|
|
|
|
* structure:
|
2017-03-30 21:15:56 +00:00
|
|
|
* {{
|
|
|
|
* jid: jid,//the JID of the participant that changed his display name
|
|
|
|
* displayname: displayName //the new display name
|
|
|
|
* }}
|
2018-11-08 12:25:02 +00:00
|
|
|
* {@code participantJoined} - receives event notifications about new
|
|
|
|
* participant.
|
2017-03-30 21:15:56 +00:00
|
|
|
* The listener will receive object with the following structure:
|
|
|
|
* {{
|
|
|
|
* jid: jid //the jid of the participant
|
|
|
|
* }}
|
2018-11-08 12:25:02 +00:00
|
|
|
* {@code participantLeft} - receives event notifications about the
|
|
|
|
* participant that left the room.
|
2017-03-30 21:15:56 +00:00
|
|
|
* The listener will receive object with the following structure:
|
|
|
|
* {{
|
|
|
|
* jid: jid //the jid of the participant
|
|
|
|
* }}
|
2019-08-09 08:09:33 +00:00
|
|
|
* {@code videoConferenceJoined} - receives event notifications about the
|
2018-11-08 12:25:02 +00:00
|
|
|
* local user has successfully joined the video conference.
|
2017-03-30 21:15:56 +00:00
|
|
|
* The listener will receive object with the following structure:
|
|
|
|
* {{
|
|
|
|
* roomName: room //the room name of the conference
|
|
|
|
* }}
|
2019-08-09 08:09:33 +00:00
|
|
|
* {@code videoConferenceLeft} - receives event notifications about the
|
2018-11-08 12:25:02 +00:00
|
|
|
* local user has left the video conference.
|
2017-03-30 21:15:56 +00:00
|
|
|
* The listener will receive object with the following structure:
|
|
|
|
* {{
|
|
|
|
* roomName: room //the room name of the conference
|
|
|
|
* }}
|
2018-11-08 12:25:02 +00:00
|
|
|
* {@code screenSharingStatusChanged} - receives event notifications about
|
2018-01-30 13:43:06 +00:00
|
|
|
* turning on/off the local user screen sharing.
|
|
|
|
* The listener will receive object with the following structure:
|
|
|
|
* {{
|
|
|
|
* on: on //whether screen sharing is on
|
|
|
|
* }}
|
2019-08-09 08:09:33 +00:00
|
|
|
* {@code dominantSpeakerChanged} - receives event notifications about
|
|
|
|
* change in the dominant speaker.
|
|
|
|
* The listener will receive object with the following structure:
|
|
|
|
* {{
|
|
|
|
* id: participantId //participantId of the new dominant speaker
|
|
|
|
* }}
|
2019-06-26 14:20:51 +00:00
|
|
|
* {@code suspendDetected} - receives event notifications about detecting suspend event in host computer.
|
2018-11-08 12:25:02 +00:00
|
|
|
* {@code readyToClose} - all hangup operations are completed and Jitsi Meet
|
|
|
|
* is ready to be disposed.
|
2017-04-03 15:48:46 +00:00
|
|
|
* @returns {void}
|
2017-03-31 16:38:44 +00:00
|
|
|
*
|
2017-04-03 15:48:46 +00:00
|
|
|
* @deprecated
|
2017-03-31 16:38:44 +00:00
|
|
|
* NOTE: This method is not removed for backward comatability purposes.
|
2017-03-30 21:15:56 +00:00
|
|
|
*/
|
2017-04-03 15:48:46 +00:00
|
|
|
addEventListeners(listeners) {
|
|
|
|
for (const event in listeners) { // eslint-disable-line guard-for-in
|
|
|
|
this.addEventListener(event, listeners[event]);
|
2017-03-30 21:15:56 +00:00
|
|
|
}
|
2016-06-17 20:35:40 +00:00
|
|
|
}
|
2017-03-30 21:15:56 +00:00
|
|
|
|
2020-09-18 15:53:27 +00:00
|
|
|
/**
|
|
|
|
* Captures the screenshot of the large video.
|
|
|
|
*
|
2020-09-22 19:45:51 +00:00
|
|
|
* @returns {Promise<string>} - Resolves with a base64 encoded image data of the screenshot
|
|
|
|
* if large video is detected, an error otherwise.
|
2020-09-18 15:53:27 +00:00
|
|
|
*/
|
|
|
|
captureLargeVideoScreenshot() {
|
|
|
|
return this._transport.sendRequest({
|
|
|
|
name: 'capture-largevideo-screenshot'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-03-30 21:15:56 +00:00
|
|
|
/**
|
2017-04-03 15:48:46 +00:00
|
|
|
* Removes the listeners and removes the Jitsi Meet frame.
|
2017-03-31 16:38:44 +00:00
|
|
|
*
|
2017-04-03 15:48:46 +00:00
|
|
|
* @returns {void}
|
2017-03-30 21:15:56 +00:00
|
|
|
*/
|
2017-04-03 15:48:46 +00:00
|
|
|
dispose() {
|
2019-02-25 15:34:54 +00:00
|
|
|
this.emit('_willDispose');
|
2017-04-18 03:17:23 +00:00
|
|
|
this._transport.dispose();
|
2017-04-18 22:54:56 +00:00
|
|
|
this.removeAllListeners();
|
2019-06-27 12:32:33 +00:00
|
|
|
if (this._frame && this._frame.parentNode) {
|
2017-07-13 18:23:32 +00:00
|
|
|
this._frame.parentNode.removeChild(this._frame);
|
2017-04-18 22:54:56 +00:00
|
|
|
}
|
2017-01-18 19:24:30 +00:00
|
|
|
}
|
2016-06-17 20:35:40 +00:00
|
|
|
|
2017-03-30 21:15:56 +00:00
|
|
|
/**
|
2017-04-03 15:48:46 +00:00
|
|
|
* Executes command. The available commands are:
|
2018-11-08 12:25:02 +00:00
|
|
|
* {@code displayName} - Sets the display name of the local participant to
|
|
|
|
* the value passed in the arguments array.
|
2019-02-17 14:40:24 +00:00
|
|
|
* {@code subject} - Sets the subject of the conference, the value passed
|
2019-03-12 17:45:53 +00:00
|
|
|
* in the arguments array. Note: Available only for moderator.
|
2019-02-17 14:40:24 +00:00
|
|
|
*
|
2018-11-08 12:25:02 +00:00
|
|
|
* {@code toggleAudio} - Mutes / unmutes audio with no arguments.
|
|
|
|
* {@code toggleVideo} - Mutes / unmutes video with no arguments.
|
|
|
|
* {@code toggleFilmStrip} - Hides / shows the filmstrip with no arguments.
|
|
|
|
*
|
2017-04-03 15:48:46 +00:00
|
|
|
* If the command doesn't require any arguments the parameter should be set
|
|
|
|
* to empty array or it may be omitted.
|
|
|
|
*
|
|
|
|
* @param {string} name - The name of the command.
|
|
|
|
* @returns {void}
|
2017-03-30 21:15:56 +00:00
|
|
|
*/
|
2017-04-03 15:48:46 +00:00
|
|
|
executeCommand(name, ...args) {
|
|
|
|
if (!(name in commands)) {
|
2019-09-06 10:57:52 +00:00
|
|
|
console.error('Not supported command name.');
|
2017-04-03 15:48:46 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2017-04-18 03:17:23 +00:00
|
|
|
this._transport.sendEvent({
|
2017-04-27 20:21:01 +00:00
|
|
|
data: args,
|
|
|
|
name: commands[name]
|
2017-04-03 15:48:46 +00:00
|
|
|
});
|
2016-06-17 20:35:40 +00:00
|
|
|
}
|
|
|
|
|
2017-03-30 21:15:56 +00:00
|
|
|
/**
|
2017-04-03 15:48:46 +00:00
|
|
|
* Executes commands. The available commands are:
|
2018-11-08 12:25:02 +00:00
|
|
|
* {@code displayName} - Sets the display name of the local participant to
|
|
|
|
* the value passed in the arguments array.
|
|
|
|
* {@code toggleAudio} - Mutes / unmutes audio. No arguments.
|
|
|
|
* {@code toggleVideo} - Mutes / unmutes video. No arguments.
|
|
|
|
* {@code toggleFilmStrip} - Hides / shows the filmstrip. No arguments.
|
|
|
|
* {@code toggleChat} - Hides / shows chat. No arguments.
|
|
|
|
* {@code toggleShareScreen} - Starts / stops screen sharing. No arguments.
|
2017-04-03 15:48:46 +00:00
|
|
|
*
|
|
|
|
* @param {Object} commandList - The object with commands to be executed.
|
|
|
|
* The keys of the object are the commands that will be executed and the
|
|
|
|
* values are the arguments for the command.
|
|
|
|
* @returns {void}
|
2017-03-30 21:15:56 +00:00
|
|
|
*/
|
2017-04-03 15:48:46 +00:00
|
|
|
executeCommands(commandList) {
|
|
|
|
for (const key in commandList) { // eslint-disable-line guard-for-in
|
|
|
|
this.executeCommand(key, commandList[key]);
|
2017-03-30 21:15:56 +00:00
|
|
|
}
|
|
|
|
}
|
2016-06-17 20:35:40 +00:00
|
|
|
|
2019-03-21 12:33:40 +00:00
|
|
|
/**
|
2019-03-28 16:29:30 +00:00
|
|
|
* Returns Promise that resolves with a list of available devices.
|
2019-03-21 12:33:40 +00:00
|
|
|
*
|
|
|
|
* @returns {Promise}
|
|
|
|
*/
|
|
|
|
getAvailableDevices() {
|
|
|
|
return getAvailableDevices(this._transport);
|
|
|
|
}
|
|
|
|
|
2021-01-12 09:13:20 +00:00
|
|
|
/**
|
|
|
|
* Gets a list of the currently sharing participant id's.
|
|
|
|
*
|
|
|
|
* @returns {Promise} - Resolves with the list of participant id's currently sharing.
|
|
|
|
*/
|
|
|
|
getContentSharingParticipants() {
|
|
|
|
return this._transport.sendRequest({
|
|
|
|
name: 'get-content-sharing-participants'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-03-21 12:33:40 +00:00
|
|
|
/**
|
|
|
|
* Returns Promise that resolves with current selected devices.
|
|
|
|
*
|
|
|
|
* @returns {Promise}
|
|
|
|
*/
|
|
|
|
getCurrentDevices() {
|
|
|
|
return getCurrentDevices(this._transport);
|
|
|
|
}
|
|
|
|
|
2021-07-20 11:37:22 +00:00
|
|
|
/**
|
|
|
|
* Returns any custom avatars backgrounds.
|
|
|
|
*
|
|
|
|
* @returns {Promise} - Resolves with the list of custom avatar backgrounds.
|
|
|
|
*/
|
|
|
|
getCustomAvatarBackgrounds() {
|
|
|
|
return this._transport.sendRequest({
|
|
|
|
name: 'get-custom-avatar-backgrounds'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-02-09 11:43:38 +00:00
|
|
|
/**
|
|
|
|
* Returns the current livestream url.
|
|
|
|
*
|
|
|
|
* @returns {Promise} - Resolves with the current livestream URL if exists, with
|
|
|
|
* undefined if not and rejects on failure.
|
|
|
|
*/
|
|
|
|
getLivestreamUrl() {
|
|
|
|
return this._transport.sendRequest({
|
|
|
|
name: 'get-livestream-url'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-09-16 18:43:44 +00:00
|
|
|
/**
|
|
|
|
* Returns the conference participants information.
|
|
|
|
*
|
|
|
|
* @returns {Array<Object>} - Returns an array containing participants
|
|
|
|
* information like participant id, display name, avatar URL and email.
|
|
|
|
*/
|
|
|
|
getParticipantsInfo() {
|
|
|
|
const participantIds = Object.keys(this._participants);
|
|
|
|
const participantsInfo = Object.values(this._participants);
|
|
|
|
|
|
|
|
participantsInfo.forEach((participant, idx) => {
|
|
|
|
participant.participantId = participantIds[idx];
|
|
|
|
});
|
|
|
|
|
|
|
|
return participantsInfo;
|
|
|
|
}
|
|
|
|
|
2020-09-03 22:40:54 +00:00
|
|
|
/**
|
|
|
|
* Returns the current video quality setting.
|
|
|
|
*
|
|
|
|
* @returns {number}
|
|
|
|
*/
|
|
|
|
getVideoQuality() {
|
|
|
|
return this._videoQuality;
|
|
|
|
}
|
|
|
|
|
2017-08-04 08:15:11 +00:00
|
|
|
/**
|
|
|
|
* Check if the audio is available.
|
|
|
|
*
|
|
|
|
* @returns {Promise} - Resolves with true if the audio available, with
|
|
|
|
* false if not and rejects on failure.
|
|
|
|
*/
|
|
|
|
isAudioAvailable() {
|
|
|
|
return this._transport.sendRequest({
|
|
|
|
name: 'is-audio-available'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-03-21 12:33:40 +00:00
|
|
|
/**
|
|
|
|
* Returns Promise that resolves with true if the device change is available
|
|
|
|
* and with false if not.
|
|
|
|
*
|
|
|
|
* @param {string} [deviceType] - Values - 'output', 'input' or undefined.
|
|
|
|
* Default - 'input'.
|
|
|
|
* @returns {Promise}
|
|
|
|
*/
|
|
|
|
isDeviceChangeAvailable(deviceType) {
|
|
|
|
return isDeviceChangeAvailable(this._transport, deviceType);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns Promise that resolves with true if the device list is available
|
|
|
|
* and with false if not.
|
|
|
|
*
|
|
|
|
* @returns {Promise}
|
|
|
|
*/
|
|
|
|
isDeviceListAvailable() {
|
|
|
|
return isDeviceListAvailable(this._transport);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-03-28 16:29:30 +00:00
|
|
|
* Returns Promise that resolves with true if multiple audio input is supported
|
2019-03-21 12:33:40 +00:00
|
|
|
* and with false if not.
|
|
|
|
*
|
|
|
|
* @returns {Promise}
|
|
|
|
*/
|
|
|
|
isMultipleAudioInputSupported() {
|
|
|
|
return isMultipleAudioInputSupported(this._transport);
|
|
|
|
}
|
|
|
|
|
2018-04-30 12:08:11 +00:00
|
|
|
/**
|
|
|
|
* Invite people to the call.
|
|
|
|
*
|
|
|
|
* @param {Array<Object>} invitees - The invitees.
|
|
|
|
* @returns {Promise} - Resolves on success and rejects on failure.
|
|
|
|
*/
|
|
|
|
invite(invitees) {
|
2018-08-03 17:06:06 +00:00
|
|
|
if (!Array.isArray(invitees) || invitees.length === 0) {
|
|
|
|
return Promise.reject(new TypeError('Invalid Argument'));
|
|
|
|
}
|
|
|
|
|
2018-04-30 12:08:11 +00:00
|
|
|
return this._transport.sendRequest({
|
|
|
|
name: 'invite',
|
|
|
|
invitees
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-08-04 08:15:11 +00:00
|
|
|
/**
|
|
|
|
* Returns the audio mute status.
|
|
|
|
*
|
|
|
|
* @returns {Promise} - Resolves with the audio mute status and rejects on
|
|
|
|
* failure.
|
|
|
|
*/
|
|
|
|
isAudioMuted() {
|
|
|
|
return this._transport.sendRequest({
|
|
|
|
name: 'is-audio-muted'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-04-26 12:32:18 +00:00
|
|
|
/**
|
|
|
|
* Returns the audio disabled status.
|
|
|
|
*
|
|
|
|
* @returns {Promise} - Resolves with the audio disabled status and rejects on
|
|
|
|
* failure.
|
|
|
|
*/
|
|
|
|
isAudioDisabled() {
|
|
|
|
return this._transport.sendRequest({
|
|
|
|
name: 'is-audio-disabled'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-09-29 13:41:23 +00:00
|
|
|
/**
|
|
|
|
* Returns the moderation on status on the given mediaType.
|
|
|
|
*
|
|
|
|
* @param {string} mediaType - The media type for which to check moderation.
|
|
|
|
* @returns {Promise} - Resolves with the moderation on status and rejects on
|
|
|
|
* failure.
|
|
|
|
*/
|
|
|
|
isModerationOn(mediaType) {
|
|
|
|
return this._transport.sendRequest({
|
|
|
|
name: 'is-moderation-on',
|
|
|
|
mediaType
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns force muted status of the given participant id for the given media type.
|
|
|
|
*
|
|
|
|
* @param {string} participantId - The id of the participant to check.
|
|
|
|
* @param {string} mediaType - The media type for which to check.
|
|
|
|
* @returns {Promise} - Resolves with the force muted status and rejects on
|
|
|
|
* failure.
|
|
|
|
*/
|
|
|
|
isParticipantForceMuted(participantId, mediaType) {
|
|
|
|
return this._transport.sendRequest({
|
|
|
|
name: 'is-participant-force-muted',
|
|
|
|
participantId,
|
|
|
|
mediaType
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-02-01 10:45:54 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the participants pane is open.
|
|
|
|
*
|
|
|
|
* @returns {Promise} - Resolves with true if the participants pane is open
|
|
|
|
* and with false if not.
|
|
|
|
*/
|
|
|
|
isParticipantsPaneOpen() {
|
|
|
|
return this._transport.sendRequest({
|
|
|
|
name: 'is-participants-pane-open'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-05-20 00:21:03 +00:00
|
|
|
/**
|
|
|
|
* Returns screen sharing status.
|
|
|
|
*
|
|
|
|
* @returns {Promise} - Resolves with screensharing status and rejects on failure.
|
|
|
|
*/
|
|
|
|
isSharingScreen() {
|
|
|
|
return this._transport.sendRequest({
|
|
|
|
name: 'is-sharing-screen'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-04-18 13:19:19 +00:00
|
|
|
/**
|
|
|
|
* Returns wether meeting is started silent.
|
|
|
|
*
|
|
|
|
* @returns {Promise} - Resolves with start silent status.
|
|
|
|
*/
|
|
|
|
isStartSilent() {
|
|
|
|
return this._transport.sendRequest({
|
|
|
|
name: 'is-start-silent'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-12-05 03:27:17 +00:00
|
|
|
/**
|
|
|
|
* Returns the avatar URL of a participant.
|
|
|
|
*
|
|
|
|
* @param {string} participantId - The id of the participant.
|
|
|
|
* @returns {string} The avatar URL.
|
|
|
|
*/
|
|
|
|
getAvatarURL(participantId) {
|
|
|
|
const { avatarURL } = this._participants[participantId] || {};
|
|
|
|
|
|
|
|
return avatarURL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-10-07 11:49:15 +00:00
|
|
|
* Gets the deployment info.
|
|
|
|
*
|
|
|
|
* @returns {Promise} - Resolves with the deployment info object.
|
|
|
|
*/
|
|
|
|
getDeploymentInfo() {
|
|
|
|
return this._transport.sendRequest({
|
|
|
|
name: 'deployment-info'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-12-05 03:27:17 +00:00
|
|
|
* Returns the display name of a participant.
|
|
|
|
*
|
|
|
|
* @param {string} participantId - The id of the participant.
|
|
|
|
* @returns {string} The display name.
|
|
|
|
*/
|
|
|
|
getDisplayName(participantId) {
|
|
|
|
const { displayName } = this._participants[participantId] || {};
|
|
|
|
|
|
|
|
return displayName;
|
|
|
|
}
|
|
|
|
|
2018-06-18 09:19:07 +00:00
|
|
|
/**
|
|
|
|
* Returns the email of a participant.
|
|
|
|
*
|
|
|
|
* @param {string} participantId - The id of the participant.
|
|
|
|
* @returns {string} The email.
|
|
|
|
*/
|
|
|
|
getEmail(participantId) {
|
|
|
|
const { email } = this._participants[participantId] || {};
|
|
|
|
|
|
|
|
return email;
|
|
|
|
}
|
|
|
|
|
2017-07-13 18:10:32 +00:00
|
|
|
/**
|
|
|
|
* Returns the iframe that loads Jitsi Meet.
|
|
|
|
*
|
|
|
|
* @returns {HTMLElement} The iframe.
|
|
|
|
*/
|
|
|
|
getIFrame() {
|
2017-07-13 18:20:00 +00:00
|
|
|
return this._frame;
|
2017-07-13 18:10:32 +00:00
|
|
|
}
|
|
|
|
|
2017-03-30 21:15:56 +00:00
|
|
|
/**
|
2017-04-03 15:48:46 +00:00
|
|
|
* Returns the number of participants in the conference. The local
|
|
|
|
* participant is included.
|
|
|
|
*
|
|
|
|
* @returns {int} The number of participants in the conference.
|
2017-03-30 21:15:56 +00:00
|
|
|
*/
|
|
|
|
getNumberOfParticipants() {
|
2017-07-13 18:20:00 +00:00
|
|
|
return this._numberOfParticipants;
|
2017-03-30 21:15:56 +00:00
|
|
|
}
|
2017-01-18 19:20:32 +00:00
|
|
|
|
2017-08-04 08:15:11 +00:00
|
|
|
/**
|
|
|
|
* Check if the video is available.
|
|
|
|
*
|
|
|
|
* @returns {Promise} - Resolves with true if the video available, with
|
|
|
|
* false if not and rejects on failure.
|
|
|
|
*/
|
|
|
|
isVideoAvailable() {
|
|
|
|
return this._transport.sendRequest({
|
|
|
|
name: 'is-video-available'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the audio mute status.
|
|
|
|
*
|
|
|
|
* @returns {Promise} - Resolves with the audio mute status and rejects on
|
|
|
|
* failure.
|
|
|
|
*/
|
|
|
|
isVideoMuted() {
|
|
|
|
return this._transport.sendRequest({
|
|
|
|
name: 'is-video-muted'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-02-04 10:51:33 +00:00
|
|
|
/**
|
|
|
|
* Returns the list of breakout rooms.
|
|
|
|
*
|
|
|
|
* @returns {Promise} Resolves with the list of breakout rooms.
|
|
|
|
*/
|
|
|
|
listBreakoutRooms() {
|
|
|
|
return this._transport.sendRequest({
|
|
|
|
name: 'list-breakout-rooms'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-09-22 16:25:13 +00:00
|
|
|
/**
|
|
|
|
* Pins a participant's video on to the stage view.
|
|
|
|
*
|
|
|
|
* @param {string} participantId - Participant id (JID) of the participant
|
|
|
|
* that needs to be pinned on the stage view.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
pinParticipant(participantId) {
|
|
|
|
this.executeCommand('pinParticipant', participantId);
|
|
|
|
}
|
|
|
|
|
2017-03-30 21:15:56 +00:00
|
|
|
/**
|
2017-04-03 15:48:46 +00:00
|
|
|
* Removes event listener.
|
|
|
|
*
|
|
|
|
* @param {string} event - The name of the event.
|
|
|
|
* @returns {void}
|
|
|
|
*
|
|
|
|
* @deprecated
|
|
|
|
* NOTE: This method is not removed for backward comatability purposes.
|
2017-03-30 21:15:56 +00:00
|
|
|
*/
|
2017-04-03 15:48:46 +00:00
|
|
|
removeEventListener(event) {
|
2017-04-18 22:54:56 +00:00
|
|
|
this.removeAllListeners(event);
|
2017-03-30 21:15:56 +00:00
|
|
|
}
|
2017-01-18 19:20:32 +00:00
|
|
|
|
2017-03-30 21:15:56 +00:00
|
|
|
/**
|
2017-04-03 15:48:46 +00:00
|
|
|
* Removes event listeners.
|
|
|
|
*
|
|
|
|
* @param {Array<string>} eventList - Array with the names of the events.
|
|
|
|
* @returns {void}
|
|
|
|
*
|
|
|
|
* @deprecated
|
|
|
|
* NOTE: This method is not removed for backward comatability purposes.
|
2017-03-30 21:15:56 +00:00
|
|
|
*/
|
2017-04-03 15:48:46 +00:00
|
|
|
removeEventListeners(eventList) {
|
|
|
|
eventList.forEach(event => this.removeEventListener(event));
|
2017-03-30 21:15:56 +00:00
|
|
|
}
|
2018-06-12 22:40:12 +00:00
|
|
|
|
2020-09-16 23:16:32 +00:00
|
|
|
/**
|
|
|
|
* Resizes the large video container as per the dimensions provided.
|
|
|
|
*
|
|
|
|
* @param {number} width - Width that needs to be applied on the large video container.
|
|
|
|
* @param {number} height - Height that needs to be applied on the large video container.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
resizeLargeVideo(width, height) {
|
|
|
|
if (width <= this._width && height <= this._height) {
|
|
|
|
this.executeCommand('resizeLargeVideo', width, height);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-26 20:53:11 +00:00
|
|
|
/**
|
|
|
|
* Passes an event along to the local conference participant to establish
|
|
|
|
* or update a direct peer connection. This is currently used for developing
|
|
|
|
* wireless screensharing with room integration and it is advised against to
|
|
|
|
* use as its api may change.
|
|
|
|
*
|
|
|
|
* @param {Object} event - An object with information to pass along.
|
|
|
|
* @param {Object} event.data - The payload of the event.
|
|
|
|
* @param {string} event.from - The jid of the sender of the event. Needed
|
|
|
|
* when a reply is to be sent regarding the event.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
sendProxyConnectionEvent(event) {
|
|
|
|
this._transport.sendEvent({
|
|
|
|
data: [ event ],
|
|
|
|
name: 'proxy-connection-event'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-03-21 12:33:40 +00:00
|
|
|
/**
|
2019-03-28 16:29:30 +00:00
|
|
|
* Sets the audio input device to the one with the label or id that is
|
|
|
|
* passed.
|
2019-03-21 12:33:40 +00:00
|
|
|
*
|
2019-03-28 16:29:30 +00:00
|
|
|
* @param {string} label - The label of the new device.
|
2019-03-21 12:33:40 +00:00
|
|
|
* @param {string} deviceId - The id of the new device.
|
|
|
|
* @returns {Promise}
|
|
|
|
*/
|
2019-03-28 16:29:30 +00:00
|
|
|
setAudioInputDevice(label, deviceId) {
|
|
|
|
return setAudioInputDevice(this._transport, label, deviceId);
|
2019-03-21 12:33:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-03-28 16:29:30 +00:00
|
|
|
* Sets the audio output device to the one with the label or id that is
|
|
|
|
* passed.
|
2019-03-21 12:33:40 +00:00
|
|
|
*
|
2019-03-28 16:29:30 +00:00
|
|
|
* @param {string} label - The label of the new device.
|
2019-03-21 12:33:40 +00:00
|
|
|
* @param {string} deviceId - The id of the new device.
|
|
|
|
* @returns {Promise}
|
|
|
|
*/
|
2019-03-28 16:29:30 +00:00
|
|
|
setAudioOutputDevice(label, deviceId) {
|
|
|
|
return setAudioOutputDevice(this._transport, label, deviceId);
|
2019-03-21 12:33:40 +00:00
|
|
|
}
|
|
|
|
|
2020-09-14 21:26:32 +00:00
|
|
|
/**
|
|
|
|
* Displays the given participant on the large video. If no participant id is specified,
|
|
|
|
* dominant and pinned speakers will be taken into consideration while selecting the
|
|
|
|
* the large video participant.
|
|
|
|
*
|
|
|
|
* @param {string} participantId - Jid of the participant to be displayed on the large video.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
setLargeVideoParticipant(participantId) {
|
|
|
|
this.executeCommand('setLargeVideoParticipant', participantId);
|
|
|
|
}
|
|
|
|
|
2019-03-21 12:33:40 +00:00
|
|
|
/**
|
2019-03-28 16:29:30 +00:00
|
|
|
* Sets the video input device to the one with the label or id that is
|
|
|
|
* passed.
|
2019-03-21 12:33:40 +00:00
|
|
|
*
|
2019-03-28 16:29:30 +00:00
|
|
|
* @param {string} label - The label of the new device.
|
2019-03-21 12:33:40 +00:00
|
|
|
* @param {string} deviceId - The id of the new device.
|
|
|
|
* @returns {Promise}
|
|
|
|
*/
|
2019-03-28 16:29:30 +00:00
|
|
|
setVideoInputDevice(label, deviceId) {
|
|
|
|
return setVideoInputDevice(this._transport, label, deviceId);
|
2019-03-21 12:33:40 +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.
|
|
|
|
* 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.
|
|
|
|
* No other params should be passed.
|
|
|
|
*
|
|
|
|
* @param {Object} options - An object with config options to pass along.
|
|
|
|
* @param { string } options.mode - Recording mode, either `file` or `stream`.
|
|
|
|
* @param { string } options.dropboxToken - Dropbox oauth2 token.
|
|
|
|
* @param { boolean } options.shouldShare - Whether the recording should be shared with the participants or not.
|
|
|
|
* Only applies to certain jitsi meet deploys.
|
|
|
|
* @param { string } options.rtmpStreamKey - The RTMP stream key.
|
|
|
|
* @param { string } options.rtmpBroadcastID - The RTMP broacast ID.
|
|
|
|
* @param { string } options.youtubeStreamKey - The youtube stream key.
|
|
|
|
* @param { string } options.youtubeBroadcastID - The youtube broacast ID.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
startRecording(options) {
|
|
|
|
this.executeCommand('startRecording', options);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Stops a recording or streaming session that is in progress.
|
|
|
|
*
|
|
|
|
* @param {string} mode - `file` or `stream`.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
stopRecording(mode) {
|
2021-11-16 11:12:10 +00:00
|
|
|
this.executeCommand('stopRecording', mode);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets e2ee enabled/disabled.
|
|
|
|
*
|
|
|
|
* @param {boolean} enabled - The new value for e2ee enabled.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
toggleE2EE(enabled) {
|
|
|
|
this.executeCommand('toggleE2EE', enabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the key and keyIndex for e2ee.
|
|
|
|
*
|
|
|
|
* @param {Object} keyInfo - Json containing key information.
|
|
|
|
* @param {CryptoKey} [keyInfo.encryptionKey] - The encryption key.
|
|
|
|
* @param {number} [keyInfo.index] - The index of the encryption key.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
async setMediaEncryptionKey(keyInfo) {
|
|
|
|
const { key, index } = keyInfo;
|
|
|
|
|
|
|
|
if (key) {
|
|
|
|
const exportedKey = await crypto.subtle.exportKey('raw', key);
|
|
|
|
|
|
|
|
this.executeCommand('setMediaEncryptionKey', JSON.stringify({
|
|
|
|
exportedKey: Array.from(new Uint8Array(exportedKey)),
|
|
|
|
index }));
|
|
|
|
} else {
|
|
|
|
this.executeCommand('setMediaEncryptionKey', JSON.stringify({
|
|
|
|
exportedKey: false,
|
|
|
|
index }));
|
|
|
|
}
|
2020-10-20 18:44:44 +00:00
|
|
|
}
|
2017-03-30 21:15:56 +00:00
|
|
|
}
|