You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

external_api.js 24KB

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