Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

external_api.js 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785
  1. import EventEmitter from 'events';
  2. import { urlObjectToString } from '../../../react/features/base/util/uri';
  3. import {
  4. PostMessageTransportBackend,
  5. Transport
  6. } from '../../transport';
  7. import electronPopupsConfig from './electronPopupsConfig.json';
  8. const logger = require('jitsi-meet-logger').getLogger(__filename);
  9. const ALWAYS_ON_TOP_FILENAMES = [
  10. 'css/all.css', 'libs/alwaysontop.min.js'
  11. ];
  12. /**
  13. * Maps the names of the commands expected by the API with the name of the
  14. * commands expected by jitsi-meet
  15. */
  16. const commands = {
  17. avatarUrl: 'avatar-url',
  18. displayName: 'display-name',
  19. email: 'email',
  20. hangup: 'video-hangup',
  21. subject: 'subject',
  22. submitFeedback: 'submit-feedback',
  23. toggleAudio: 'toggle-audio',
  24. toggleChat: 'toggle-chat',
  25. toggleFilmStrip: 'toggle-film-strip',
  26. toggleShareScreen: 'toggle-share-screen',
  27. toggleVideo: 'toggle-video'
  28. };
  29. /**
  30. * Maps the names of the events expected by the API with the name of the
  31. * events expected by jitsi-meet
  32. */
  33. const events = {
  34. 'avatar-changed': 'avatarChanged',
  35. 'audio-availability-changed': 'audioAvailabilityChanged',
  36. 'audio-mute-status-changed': 'audioMuteStatusChanged',
  37. 'display-name-change': 'displayNameChange',
  38. 'email-change': 'emailChange',
  39. 'feedback-submitted': 'feedbackSubmitted',
  40. 'feedback-prompt-displayed': 'feedbackPromptDisplayed',
  41. 'filmstrip-display-changed': 'filmstripDisplayChanged',
  42. 'incoming-message': 'incomingMessage',
  43. 'outgoing-message': 'outgoingMessage',
  44. 'participant-joined': 'participantJoined',
  45. 'participant-left': 'participantLeft',
  46. 'proxy-connection-event': 'proxyConnectionEvent',
  47. 'video-ready-to-close': 'readyToClose',
  48. 'video-conference-joined': 'videoConferenceJoined',
  49. 'video-conference-left': 'videoConferenceLeft',
  50. 'video-availability-changed': 'videoAvailabilityChanged',
  51. 'video-mute-status-changed': 'videoMuteStatusChanged',
  52. 'screen-sharing-status-changed': 'screenSharingStatusChanged',
  53. 'subject-change': 'subjectChange'
  54. };
  55. /**
  56. * Last id of api object
  57. * @type {number}
  58. */
  59. let id = 0;
  60. /**
  61. * Adds given number to the numberOfParticipants property of given APIInstance.
  62. *
  63. * @param {JitsiMeetExternalAPI} APIInstance - The instance of the API.
  64. * @param {int} number - The number of participants to be added to
  65. * numberOfParticipants property (this parameter can be negative number if the
  66. * numberOfParticipants should be decreased).
  67. * @returns {void}
  68. */
  69. function changeParticipantNumber(APIInstance, number) {
  70. APIInstance._numberOfParticipants += number;
  71. }
  72. /**
  73. * Generates the URL for the iframe.
  74. *
  75. * @param {string} domain - The domain name of the server that hosts the
  76. * conference.
  77. * @param {string} [options] - Another optional parameters.
  78. * @param {Object} [options.configOverwrite] - Object containing configuration
  79. * options defined in config.js to be overridden.
  80. * @param {Object} [options.interfaceConfigOverwrite] - Object containing
  81. * configuration options defined in interface_config.js to be overridden.
  82. * @param {string} [options.jwt] - The JWT token if needed by jitsi-meet for
  83. * authentication.
  84. * @param {boolean} [options.noSSL] - If the value is true https won't be used.
  85. * @param {string} [options.roomName] - The name of the room to join.
  86. * @returns {string} The URL.
  87. */
  88. function generateURL(domain, options = {}) {
  89. return urlObjectToString({
  90. ...options,
  91. url:
  92. `${options.noSSL ? 'http' : 'https'}://${
  93. domain}/#jitsi_meet_external_api_id=${id}`
  94. });
  95. }
  96. /**
  97. * Parses the arguments passed to the constructor. If the old format is used
  98. * the function translates the arguments to the new format.
  99. *
  100. * @param {Array} args - The arguments to be parsed.
  101. * @returns {Object} JS object with properties.
  102. */
  103. function parseArguments(args) {
  104. if (!args.length) {
  105. return {};
  106. }
  107. const firstArg = args[0];
  108. switch (typeof firstArg) {
  109. case 'string': // old arguments format
  110. case undefined: {
  111. // Not sure which format but we are trying to parse the old
  112. // format because if the new format is used everything will be undefined
  113. // anyway.
  114. const [
  115. roomName,
  116. width,
  117. height,
  118. parentNode,
  119. configOverwrite,
  120. interfaceConfigOverwrite,
  121. noSSL,
  122. jwt,
  123. onload
  124. ] = args;
  125. return {
  126. roomName,
  127. width,
  128. height,
  129. parentNode,
  130. configOverwrite,
  131. interfaceConfigOverwrite,
  132. noSSL,
  133. jwt,
  134. onload
  135. };
  136. }
  137. case 'object': // new arguments format
  138. return args[0];
  139. default:
  140. throw new Error('Can\'t parse the arguments!');
  141. }
  142. }
  143. /**
  144. * Compute valid values for height and width. If a number is specified it's
  145. * treated as pixel units. If the value is expressed in px, em, pt or
  146. * percentage, it's used as is.
  147. *
  148. * @param {any} value - The value to be parsed.
  149. * @returns {string|undefined} The parsed value that can be used for setting
  150. * sizes through the style property. If invalid value is passed the method
  151. * retuns undefined.
  152. */
  153. function parseSizeParam(value) {
  154. let parsedValue;
  155. // This regex parses values of the form 100px, 100em, 100pt or 100%.
  156. // Values like 100 or 100px are handled outside of the regex, and
  157. // invalid values will be ignored and the minimum will be used.
  158. const re = /([0-9]*\.?[0-9]+)(em|pt|px|%)$/;
  159. if (typeof value === 'string' && String(value).match(re) !== null) {
  160. parsedValue = value;
  161. } else if (typeof value === 'number') {
  162. parsedValue = `${value}px`;
  163. }
  164. return parsedValue;
  165. }
  166. /**
  167. * The IFrame API interface class.
  168. */
  169. export default class JitsiMeetExternalAPI extends EventEmitter {
  170. /**
  171. * Constructs new API instance. Creates iframe and loads Jitsi Meet in it.
  172. *
  173. * @param {string} domain - The domain name of the server that hosts the
  174. * conference.
  175. * @param {Object} [options] - Optional arguments.
  176. * @param {string} [options.roomName] - The name of the room to join.
  177. * @param {number|string} [options.width] - Width of the iframe. Check
  178. * parseSizeParam for format details.
  179. * @param {number|string} [options.height] - Height of the iframe. Check
  180. * parseSizeParam for format details.
  181. * @param {DOMElement} [options.parentNode] - The node that will contain the
  182. * iframe.
  183. * @param {Object} [options.configOverwrite] - Object containing
  184. * configuration options defined in config.js to be overridden.
  185. * @param {Object} [options.interfaceConfigOverwrite] - Object containing
  186. * configuration options defined in interface_config.js to be overridden.
  187. * @param {boolean} [options.noSSL] - If the value is true https won't be
  188. * used.
  189. * @param {string} [options.jwt] - The JWT token if needed by jitsi-meet for
  190. * authentication.
  191. * @param {string} [options.onload] - The onload function that will listen
  192. * for iframe onload event.
  193. * @param {Array<Object>} [options.invitees] - Array of objects containing
  194. * information about new participants that will be invited in the call.
  195. */
  196. constructor(domain, ...args) {
  197. super();
  198. const {
  199. roomName = '',
  200. width = '100%',
  201. height = '100%',
  202. parentNode = document.body,
  203. configOverwrite = {},
  204. interfaceConfigOverwrite = {},
  205. noSSL = false,
  206. jwt = undefined,
  207. onload = undefined,
  208. invitees
  209. } = parseArguments(args);
  210. this._parentNode = parentNode;
  211. this._url = generateURL(domain, {
  212. configOverwrite,
  213. interfaceConfigOverwrite,
  214. jwt,
  215. noSSL,
  216. roomName
  217. });
  218. this._createIFrame(height, width, onload);
  219. this._transport = new Transport({
  220. backend: new PostMessageTransportBackend({
  221. postisOptions: {
  222. scope: `jitsi_meet_external_api_${id}`,
  223. window: this._frame.contentWindow
  224. }
  225. })
  226. });
  227. if (Array.isArray(invitees) && invitees.length > 0) {
  228. this.invite(invitees);
  229. }
  230. this._isLargeVideoVisible = true;
  231. this._numberOfParticipants = 0;
  232. this._participants = {};
  233. this._myUserID = undefined;
  234. this._onStageParticipant = undefined;
  235. this._setupListeners();
  236. id++;
  237. }
  238. /**
  239. * Creates the iframe element.
  240. *
  241. * @param {number|string} height - The height of the iframe. Check
  242. * parseSizeParam for format details.
  243. * @param {number|string} width - The with of the iframe. Check
  244. * parseSizeParam for format details.
  245. * @param {Function} onload - The function that will listen
  246. * for onload event.
  247. * @returns {void}
  248. *
  249. * @private
  250. */
  251. _createIFrame(height, width, onload) {
  252. const frameName = `jitsiConferenceFrame${id}`;
  253. this._frame = document.createElement('iframe');
  254. this._frame.allow = 'camera; microphone';
  255. this._frame.src = this._url;
  256. this._frame.name = frameName;
  257. this._frame.id = frameName;
  258. this._setSize(height, width);
  259. this._frame.setAttribute('allowFullScreen', 'true');
  260. this._frame.style.border = 0;
  261. if (onload) {
  262. // waits for iframe resources to load
  263. // and fires event when it is done
  264. this._frame.onload = onload;
  265. }
  266. this._frame = this._parentNode.appendChild(this._frame);
  267. }
  268. /**
  269. * Returns arrays with the all resources for the always on top feature.
  270. *
  271. * @returns {Array<string>}
  272. */
  273. _getAlwaysOnTopResources() {
  274. const iframeWindow = this._frame.contentWindow;
  275. const iframeDocument = iframeWindow.document;
  276. let baseURL = '';
  277. const base = iframeDocument.querySelector('base');
  278. if (base && base.href) {
  279. baseURL = base.href;
  280. } else {
  281. const { protocol, host } = iframeWindow.location;
  282. baseURL = `${protocol}//${host}`;
  283. }
  284. return ALWAYS_ON_TOP_FILENAMES.map(
  285. filename => (new URL(filename, baseURL)).href
  286. );
  287. }
  288. /**
  289. * Returns the id of the on stage participant.
  290. *
  291. * @returns {string} - The id of the on stage participant.
  292. */
  293. _getOnStageParticipant() {
  294. return this._onStageParticipant;
  295. }
  296. /**
  297. * Getter for the large video element in Jitsi Meet.
  298. *
  299. * @returns {HTMLElement|undefined} - The large video.
  300. */
  301. _getLargeVideo() {
  302. const iframe = this.getIFrame();
  303. if (!this._isLargeVideoVisible
  304. || !iframe
  305. || !iframe.contentWindow
  306. || !iframe.contentWindow.document) {
  307. return;
  308. }
  309. return iframe.contentWindow.document.getElementById('largeVideo');
  310. }
  311. /**
  312. * Sets the size of the iframe element.
  313. *
  314. * @param {number|string} height - The height of the iframe.
  315. * @param {number|string} width - The with of the iframe.
  316. * @returns {void}
  317. *
  318. * @private
  319. */
  320. _setSize(height, width) {
  321. const parsedHeight = parseSizeParam(height);
  322. const parsedWidth = parseSizeParam(width);
  323. if (parsedHeight !== undefined) {
  324. this._frame.style.height = parsedHeight;
  325. }
  326. if (parsedWidth !== undefined) {
  327. this._frame.style.width = parsedWidth;
  328. }
  329. }
  330. /**
  331. * Setups listeners that are used internally for JitsiMeetExternalAPI.
  332. *
  333. * @returns {void}
  334. *
  335. * @private
  336. */
  337. _setupListeners() {
  338. this._transport.on('event', ({ name, ...data }) => {
  339. const userID = data.id;
  340. switch (name) {
  341. case 'video-conference-joined':
  342. this._myUserID = userID;
  343. this._participants[userID] = {
  344. avatarURL: data.avatarURL
  345. };
  346. // eslint-disable-next-line no-fallthrough
  347. case 'participant-joined': {
  348. this._participants[userID] = this._participants[userID] || {};
  349. this._participants[userID].displayName = data.displayName;
  350. this._participants[userID].formattedDisplayName
  351. = data.formattedDisplayName;
  352. changeParticipantNumber(this, 1);
  353. break;
  354. }
  355. case 'participant-left':
  356. changeParticipantNumber(this, -1);
  357. delete this._participants[userID];
  358. break;
  359. case 'display-name-change': {
  360. const user = this._participants[userID];
  361. if (user) {
  362. user.displayName = data.displayname;
  363. user.formattedDisplayName = data.formattedDisplayName;
  364. }
  365. break;
  366. }
  367. case 'email-change': {
  368. const user = this._participants[userID];
  369. if (user) {
  370. user.email = data.email;
  371. }
  372. break;
  373. }
  374. case 'avatar-changed': {
  375. const user = this._participants[userID];
  376. if (user) {
  377. user.avatarURL = data.avatarURL;
  378. }
  379. break;
  380. }
  381. case 'on-stage-participant-changed':
  382. this._onStageParticipant = userID;
  383. this.emit('largeVideoChanged');
  384. break;
  385. case 'large-video-visibility-changed':
  386. this._isLargeVideoVisible = data.isVisible;
  387. this.emit('largeVideoChanged');
  388. break;
  389. case 'video-conference-left':
  390. changeParticipantNumber(this, -1);
  391. delete this._participants[this._myUserID];
  392. break;
  393. }
  394. const eventName = events[name];
  395. if (eventName) {
  396. this.emit(eventName, data);
  397. return true;
  398. }
  399. return false;
  400. });
  401. }
  402. /**
  403. * Adds event listener to Meet Jitsi.
  404. *
  405. * @param {string} event - The name of the event.
  406. * @param {Function} listener - The listener.
  407. * @returns {void}
  408. *
  409. * @deprecated
  410. * NOTE: This method is not removed for backward comatability purposes.
  411. */
  412. addEventListener(event, listener) {
  413. this.on(event, listener);
  414. }
  415. /**
  416. * Adds event listeners to Meet Jitsi.
  417. *
  418. * @param {Object} listeners - The object key should be the name of
  419. * the event and value - the listener.
  420. * Currently we support the following
  421. * events:
  422. * {@code incomingMessage} - receives event notifications about incoming
  423. * messages. The listener will receive object with the following structure:
  424. * {{
  425. * 'from': from,//JID of the user that sent the message
  426. * 'nick': nick,//the nickname of the user that sent the message
  427. * 'message': txt//the text of the message
  428. * }}
  429. * {@code outgoingMessage} - receives event notifications about outgoing
  430. * messages. The listener will receive object with the following structure:
  431. * {{
  432. * 'message': txt//the text of the message
  433. * }}
  434. * {@code displayNameChanged} - receives event notifications about display
  435. * name change. The listener will receive object with the following
  436. * structure:
  437. * {{
  438. * jid: jid,//the JID of the participant that changed his display name
  439. * displayname: displayName //the new display name
  440. * }}
  441. * {@code participantJoined} - receives event notifications about new
  442. * participant.
  443. * The listener will receive object with the following structure:
  444. * {{
  445. * jid: jid //the jid of the participant
  446. * }}
  447. * {@code participantLeft} - receives event notifications about the
  448. * participant that left the room.
  449. * The listener will receive object with the following structure:
  450. * {{
  451. * jid: jid //the jid of the participant
  452. * }}
  453. * {@code video-conference-joined} - receives event notifications about the
  454. * local user has successfully joined the video conference.
  455. * The listener will receive object with the following structure:
  456. * {{
  457. * roomName: room //the room name of the conference
  458. * }}
  459. * {@code video-conference-left} - receives event notifications about the
  460. * local user has left the video conference.
  461. * The listener will receive object with the following structure:
  462. * {{
  463. * roomName: room //the room name of the conference
  464. * }}
  465. * {@code screenSharingStatusChanged} - receives event notifications about
  466. * turning on/off the local user screen sharing.
  467. * The listener will receive object with the following structure:
  468. * {{
  469. * on: on //whether screen sharing is on
  470. * }}
  471. * {@code readyToClose} - all hangup operations are completed and Jitsi Meet
  472. * is ready to be disposed.
  473. * @returns {void}
  474. *
  475. * @deprecated
  476. * NOTE: This method is not removed for backward comatability purposes.
  477. */
  478. addEventListeners(listeners) {
  479. for (const event in listeners) { // eslint-disable-line guard-for-in
  480. this.addEventListener(event, listeners[event]);
  481. }
  482. }
  483. /**
  484. * Removes the listeners and removes the Jitsi Meet frame.
  485. *
  486. * @returns {void}
  487. */
  488. dispose() {
  489. this.emit('_willDispose');
  490. this._transport.dispose();
  491. this.removeAllListeners();
  492. if (this._frame) {
  493. this._frame.parentNode.removeChild(this._frame);
  494. }
  495. }
  496. /**
  497. * Executes command. The available commands are:
  498. * {@code displayName} - Sets the display name of the local participant to
  499. * the value passed in the arguments array.
  500. * {@code subject} - Sets the subject of the conference, the value passed
  501. * in the arguments array. Note: available only for moderator.
  502. *
  503. * {@code toggleAudio} - Mutes / unmutes audio with no arguments.
  504. * {@code toggleVideo} - Mutes / unmutes video with no arguments.
  505. * {@code toggleFilmStrip} - Hides / shows the filmstrip with no arguments.
  506. *
  507. * If the command doesn't require any arguments the parameter should be set
  508. * to empty array or it may be omitted.
  509. *
  510. * @param {string} name - The name of the command.
  511. * @returns {void}
  512. */
  513. executeCommand(name, ...args) {
  514. if (!(name in commands)) {
  515. logger.error('Not supported command name.');
  516. return;
  517. }
  518. this._transport.sendEvent({
  519. data: args,
  520. name: commands[name]
  521. });
  522. }
  523. /**
  524. * Executes commands. The available commands are:
  525. * {@code displayName} - Sets the display name of the local participant to
  526. * the value passed in the arguments array.
  527. * {@code toggleAudio} - Mutes / unmutes audio. No arguments.
  528. * {@code toggleVideo} - Mutes / unmutes video. No arguments.
  529. * {@code toggleFilmStrip} - Hides / shows the filmstrip. No arguments.
  530. * {@code toggleChat} - Hides / shows chat. No arguments.
  531. * {@code toggleShareScreen} - Starts / stops screen sharing. No arguments.
  532. *
  533. * @param {Object} commandList - The object with commands to be executed.
  534. * The keys of the object are the commands that will be executed and the
  535. * values are the arguments for the command.
  536. * @returns {void}
  537. */
  538. executeCommands(commandList) {
  539. for (const key in commandList) { // eslint-disable-line guard-for-in
  540. this.executeCommand(key, commandList[key]);
  541. }
  542. }
  543. /**
  544. * Check if the audio is available.
  545. *
  546. * @returns {Promise} - Resolves with true if the audio available, with
  547. * false if not and rejects on failure.
  548. */
  549. isAudioAvailable() {
  550. return this._transport.sendRequest({
  551. name: 'is-audio-available'
  552. });
  553. }
  554. /**
  555. * Invite people to the call.
  556. *
  557. * @param {Array<Object>} invitees - The invitees.
  558. * @returns {Promise} - Resolves on success and rejects on failure.
  559. */
  560. invite(invitees) {
  561. if (!Array.isArray(invitees) || invitees.length === 0) {
  562. return Promise.reject(new TypeError('Invalid Argument'));
  563. }
  564. return this._transport.sendRequest({
  565. name: 'invite',
  566. invitees
  567. });
  568. }
  569. /**
  570. * Returns the audio mute status.
  571. *
  572. * @returns {Promise} - Resolves with the audio mute status and rejects on
  573. * failure.
  574. */
  575. isAudioMuted() {
  576. return this._transport.sendRequest({
  577. name: 'is-audio-muted'
  578. });
  579. }
  580. /**
  581. * Returns the avatar URL of a participant.
  582. *
  583. * @param {string} participantId - The id of the participant.
  584. * @returns {string} The avatar URL.
  585. */
  586. getAvatarURL(participantId) {
  587. const { avatarURL } = this._participants[participantId] || {};
  588. return avatarURL;
  589. }
  590. /**
  591. * Returns the display name of a participant.
  592. *
  593. * @param {string} participantId - The id of the participant.
  594. * @returns {string} The display name.
  595. */
  596. getDisplayName(participantId) {
  597. const { displayName } = this._participants[participantId] || {};
  598. return displayName;
  599. }
  600. /**
  601. * Returns the email of a participant.
  602. *
  603. * @param {string} participantId - The id of the participant.
  604. * @returns {string} The email.
  605. */
  606. getEmail(participantId) {
  607. const { email } = this._participants[participantId] || {};
  608. return email;
  609. }
  610. /**
  611. * Returns the formatted display name of a participant.
  612. *
  613. * @param {string} participantId - The id of the participant.
  614. * @returns {string} The formatted display name.
  615. */
  616. _getFormattedDisplayName(participantId) {
  617. const { formattedDisplayName }
  618. = this._participants[participantId] || {};
  619. return formattedDisplayName;
  620. }
  621. /**
  622. * Returns the iframe that loads Jitsi Meet.
  623. *
  624. * @returns {HTMLElement} The iframe.
  625. */
  626. getIFrame() {
  627. return this._frame;
  628. }
  629. /**
  630. * Returns the number of participants in the conference. The local
  631. * participant is included.
  632. *
  633. * @returns {int} The number of participants in the conference.
  634. */
  635. getNumberOfParticipants() {
  636. return this._numberOfParticipants;
  637. }
  638. /**
  639. * Check if the video is available.
  640. *
  641. * @returns {Promise} - Resolves with true if the video available, with
  642. * false if not and rejects on failure.
  643. */
  644. isVideoAvailable() {
  645. return this._transport.sendRequest({
  646. name: 'is-video-available'
  647. });
  648. }
  649. /**
  650. * Returns the audio mute status.
  651. *
  652. * @returns {Promise} - Resolves with the audio mute status and rejects on
  653. * failure.
  654. */
  655. isVideoMuted() {
  656. return this._transport.sendRequest({
  657. name: 'is-video-muted'
  658. });
  659. }
  660. /**
  661. * Removes event listener.
  662. *
  663. * @param {string} event - The name of the event.
  664. * @returns {void}
  665. *
  666. * @deprecated
  667. * NOTE: This method is not removed for backward comatability purposes.
  668. */
  669. removeEventListener(event) {
  670. this.removeAllListeners(event);
  671. }
  672. /**
  673. * Removes event listeners.
  674. *
  675. * @param {Array<string>} eventList - Array with the names of the events.
  676. * @returns {void}
  677. *
  678. * @deprecated
  679. * NOTE: This method is not removed for backward comatability purposes.
  680. */
  681. removeEventListeners(eventList) {
  682. eventList.forEach(event => this.removeEventListener(event));
  683. }
  684. /**
  685. * Passes an event along to the local conference participant to establish
  686. * or update a direct peer connection. This is currently used for developing
  687. * wireless screensharing with room integration and it is advised against to
  688. * use as its api may change.
  689. *
  690. * @param {Object} event - An object with information to pass along.
  691. * @param {Object} event.data - The payload of the event.
  692. * @param {string} event.from - The jid of the sender of the event. Needed
  693. * when a reply is to be sent regarding the event.
  694. * @returns {void}
  695. */
  696. sendProxyConnectionEvent(event) {
  697. this._transport.sendEvent({
  698. data: [ event ],
  699. name: 'proxy-connection-event'
  700. });
  701. }
  702. /**
  703. * Returns the configuration for electron for the windows that are open
  704. * from Jitsi Meet.
  705. *
  706. * @returns {Promise<Object>}
  707. *
  708. * NOTE: For internal use only.
  709. */
  710. _getElectronPopupsConfig() {
  711. return Promise.resolve(electronPopupsConfig);
  712. }
  713. }