您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

external_api.js 24KB

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