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.

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