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.

API.js 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825
  1. // @flow
  2. import * as JitsiMeetConferenceEvents from '../../ConferenceEvents';
  3. import {
  4. createApiEvent,
  5. sendAnalytics
  6. } from '../../react/features/analytics';
  7. import {
  8. sendTones,
  9. setPassword,
  10. setSubject
  11. } from '../../react/features/base/conference';
  12. import { parseJWTFromURLParams } from '../../react/features/base/jwt';
  13. import { setE2EEKey } from '../../react/features/e2ee';
  14. import { invite } from '../../react/features/invite';
  15. import { toggleTileView } from '../../react/features/video-layout';
  16. import { getJitsiMeetTransport } from '../transport';
  17. import { API_ID, ENDPOINT_TEXT_MESSAGE_NAME } from './constants';
  18. import {
  19. processExternalDeviceRequest
  20. } from '../../react/features/device-selection/functions';
  21. const logger = require('jitsi-meet-logger').getLogger(__filename);
  22. declare var APP: Object;
  23. /**
  24. * List of the available commands.
  25. */
  26. let commands = {};
  27. /**
  28. * The state of screen sharing(started/stopped) before the screen sharing is
  29. * enabled and initialized.
  30. * NOTE: This flag help us to cache the state and use it if toggle-share-screen
  31. * was received before the initialization.
  32. */
  33. let initialScreenSharingState = false;
  34. /**
  35. * The transport instance used for communication with external apps.
  36. *
  37. * @type {Transport}
  38. */
  39. const transport = getJitsiMeetTransport();
  40. /**
  41. * The current audio availability.
  42. *
  43. * @type {boolean}
  44. */
  45. let audioAvailable = true;
  46. /**
  47. * The current video availability.
  48. *
  49. * @type {boolean}
  50. */
  51. let videoAvailable = true;
  52. /**
  53. * Initializes supported commands.
  54. *
  55. * @returns {void}
  56. */
  57. function initCommands() {
  58. commands = {
  59. 'display-name': displayName => {
  60. sendAnalytics(createApiEvent('display.name.changed'));
  61. APP.conference.changeLocalDisplayName(displayName);
  62. },
  63. 'password': password => {
  64. const { conference, passwordRequired }
  65. = APP.store.getState()['features/base/conference'];
  66. if (passwordRequired) {
  67. sendAnalytics(createApiEvent('submit.password'));
  68. APP.store.dispatch(setPassword(
  69. passwordRequired,
  70. passwordRequired.join,
  71. password
  72. ));
  73. } else {
  74. sendAnalytics(createApiEvent('password.changed'));
  75. APP.store.dispatch(setPassword(
  76. conference,
  77. conference.lock,
  78. password
  79. ));
  80. }
  81. },
  82. 'proxy-connection-event': event => {
  83. APP.conference.onProxyConnectionEvent(event);
  84. },
  85. 'send-tones': (options = {}) => {
  86. const { duration, tones, pause } = options;
  87. APP.store.dispatch(sendTones(tones, duration, pause));
  88. },
  89. 'subject': subject => {
  90. sendAnalytics(createApiEvent('subject.changed'));
  91. APP.store.dispatch(setSubject(subject));
  92. },
  93. 'submit-feedback': feedback => {
  94. sendAnalytics(createApiEvent('submit.feedback'));
  95. APP.conference.submitFeedback(feedback.score, feedback.message);
  96. },
  97. 'toggle-audio': () => {
  98. sendAnalytics(createApiEvent('toggle-audio'));
  99. logger.log('Audio toggle: API command received');
  100. APP.conference.toggleAudioMuted(false /* no UI */);
  101. },
  102. 'toggle-video': () => {
  103. sendAnalytics(createApiEvent('toggle-video'));
  104. logger.log('Video toggle: API command received');
  105. APP.conference.toggleVideoMuted(false /* no UI */);
  106. },
  107. 'toggle-film-strip': () => {
  108. sendAnalytics(createApiEvent('film.strip.toggled'));
  109. APP.UI.toggleFilmstrip();
  110. },
  111. 'toggle-chat': () => {
  112. sendAnalytics(createApiEvent('chat.toggled'));
  113. APP.UI.toggleChat();
  114. },
  115. /**
  116. * Callback to invoke when the "toggle-share-screen" command is received.
  117. *
  118. * @param {Object} options - Additional details of how to perform
  119. * the action. Note this parameter is undocumented and experimental.
  120. * @param {boolean} options.enable - Whether trying to enable screen
  121. * sharing or to turn it off.
  122. * @returns {void}
  123. */
  124. 'toggle-share-screen': (options = {}) => {
  125. sendAnalytics(createApiEvent('screen.sharing.toggled'));
  126. toggleScreenSharing(options.enable);
  127. },
  128. 'toggle-tile-view': () => {
  129. sendAnalytics(createApiEvent('tile-view.toggled'));
  130. APP.store.dispatch(toggleTileView());
  131. },
  132. 'video-hangup': (showFeedbackDialog = true) => {
  133. sendAnalytics(createApiEvent('video.hangup'));
  134. APP.conference.hangup(showFeedbackDialog);
  135. },
  136. 'email': email => {
  137. sendAnalytics(createApiEvent('email.changed'));
  138. APP.conference.changeLocalEmail(email);
  139. },
  140. 'avatar-url': avatarUrl => {
  141. sendAnalytics(createApiEvent('avatar.url.changed'));
  142. APP.conference.changeLocalAvatarUrl(avatarUrl);
  143. },
  144. 'send-endpoint-text-message': (to, text) => {
  145. logger.debug('Send endpoint message command received');
  146. try {
  147. APP.conference.sendEndpointMessage(to, {
  148. name: ENDPOINT_TEXT_MESSAGE_NAME,
  149. text
  150. });
  151. } catch (err) {
  152. logger.error('Failed sending endpoint text message', err);
  153. }
  154. },
  155. 'e2ee-key': key => {
  156. logger.debug('Set E2EE key command received');
  157. APP.store.dispatch(setE2EEKey(key));
  158. }
  159. };
  160. transport.on('event', ({ data, name }) => {
  161. if (name && commands[name]) {
  162. commands[name](...data);
  163. return true;
  164. }
  165. return false;
  166. });
  167. transport.on('request', (request, callback) => {
  168. const { dispatch, getState } = APP.store;
  169. if (processExternalDeviceRequest(dispatch, getState, request, callback)) {
  170. return true;
  171. }
  172. const { name } = request;
  173. switch (name) {
  174. case 'invite': {
  175. const { invitees } = request;
  176. if (!Array.isArray(invitees) || invitees.length === 0) {
  177. callback({
  178. error: new Error('Unexpected format of invitees')
  179. });
  180. break;
  181. }
  182. // The store should be already available because API.init is called
  183. // on appWillMount action.
  184. APP.store.dispatch(
  185. invite(invitees, true))
  186. .then(failedInvitees => {
  187. let error;
  188. let result;
  189. if (failedInvitees.length) {
  190. error = new Error('One or more invites failed!');
  191. } else {
  192. result = true;
  193. }
  194. callback({
  195. error,
  196. result
  197. });
  198. });
  199. break;
  200. }
  201. case 'is-audio-muted':
  202. callback(APP.conference.isLocalAudioMuted());
  203. break;
  204. case 'is-video-muted':
  205. callback(APP.conference.isLocalVideoMuted());
  206. break;
  207. case 'is-audio-available':
  208. callback(audioAvailable);
  209. break;
  210. case 'is-video-available':
  211. callback(videoAvailable);
  212. break;
  213. default:
  214. return false;
  215. }
  216. return true;
  217. });
  218. }
  219. /**
  220. * Listens for desktop/screen sharing enabled events and toggles the screen
  221. * sharing if needed.
  222. *
  223. * @param {boolean} enabled - Current screen sharing enabled status.
  224. * @returns {void}
  225. */
  226. function onDesktopSharingEnabledChanged(enabled = false) {
  227. if (enabled && initialScreenSharingState) {
  228. toggleScreenSharing();
  229. }
  230. }
  231. /**
  232. * Check whether the API should be enabled or not.
  233. *
  234. * @returns {boolean}
  235. */
  236. function shouldBeEnabled() {
  237. return (
  238. typeof API_ID === 'number'
  239. // XXX Enable the API when a JSON Web Token (JWT) is specified in
  240. // the location/URL because then it is very likely that the Jitsi
  241. // Meet (Web) app is being used by an external/wrapping (Web) app
  242. // and, consequently, the latter will need to communicate with the
  243. // former. (The described logic is merely a heuristic though.)
  244. || parseJWTFromURLParams());
  245. }
  246. /**
  247. * Executes on toggle-share-screen command.
  248. *
  249. * @param {boolean} [enable] - Whether this toggle is to explicitly enable or
  250. * disable screensharing. If not defined, the application will automatically
  251. * attempt to toggle between enabled and disabled. This boolean is useful for
  252. * explicitly setting desired screensharing state.
  253. * @returns {void}
  254. */
  255. function toggleScreenSharing(enable) {
  256. if (APP.conference.isDesktopSharingEnabled) {
  257. // eslint-disable-next-line no-empty-function
  258. APP.conference.toggleScreenSharing(enable).catch(() => {});
  259. } else {
  260. initialScreenSharingState = !initialScreenSharingState;
  261. }
  262. }
  263. /**
  264. * Implements API class that communicates with external API class and provides
  265. * interface to access Jitsi Meet features by external applications that embed
  266. * Jitsi Meet.
  267. */
  268. class API {
  269. _enabled: boolean;
  270. /**
  271. * Initializes the API. Setups message event listeners that will receive
  272. * information from external applications that embed Jitsi Meet. It also
  273. * sends a message to the external application that API is initialized.
  274. *
  275. * @param {Object} options - Optional parameters.
  276. * @returns {void}
  277. */
  278. init() {
  279. if (!shouldBeEnabled()) {
  280. return;
  281. }
  282. /**
  283. * Current status (enabled/disabled) of API.
  284. *
  285. * @private
  286. * @type {boolean}
  287. */
  288. this._enabled = true;
  289. APP.conference.addListener(
  290. JitsiMeetConferenceEvents.DESKTOP_SHARING_ENABLED_CHANGED,
  291. onDesktopSharingEnabledChanged);
  292. initCommands();
  293. }
  294. /**
  295. * Notify external application (if API is enabled) that the large video
  296. * visibility changed.
  297. *
  298. * @param {boolean} isHidden - True if the large video is hidden and false
  299. * otherwise.
  300. * @returns {void}
  301. */
  302. notifyLargeVideoVisibilityChanged(isHidden: boolean) {
  303. this._sendEvent({
  304. name: 'large-video-visibility-changed',
  305. isVisible: !isHidden
  306. });
  307. }
  308. /**
  309. * Notifies the external application (spot) that the local jitsi-participant
  310. * has a status update.
  311. *
  312. * @param {Object} event - The message to pass onto spot.
  313. * @returns {void}
  314. */
  315. sendProxyConnectionEvent(event: Object) {
  316. this._sendEvent({
  317. name: 'proxy-connection-event',
  318. ...event
  319. });
  320. }
  321. /**
  322. * Sends event to the external application.
  323. *
  324. * @param {Object} event - The event to be sent.
  325. * @returns {void}
  326. */
  327. _sendEvent(event: Object = {}) {
  328. if (this._enabled) {
  329. transport.sendEvent(event);
  330. }
  331. }
  332. /**
  333. * Notify external application (if API is enabled) that message was sent.
  334. *
  335. * @param {string} message - Message body.
  336. * @param {boolean} privateMessage - True if the message was a private message.
  337. * @returns {void}
  338. */
  339. notifySendingChatMessage(message: string, privateMessage: boolean) {
  340. this._sendEvent({
  341. name: 'outgoing-message',
  342. message,
  343. privateMessage
  344. });
  345. }
  346. /**
  347. * Notify external application (if API is enabled) that message was
  348. * received.
  349. *
  350. * @param {Object} options - Object with the message properties.
  351. * @returns {void}
  352. */
  353. notifyReceivedChatMessage(
  354. { body, id, nick, ts }: {
  355. body: *, id: string, nick: string, ts: *
  356. } = {}) {
  357. if (APP.conference.isLocalId(id)) {
  358. return;
  359. }
  360. this._sendEvent({
  361. name: 'incoming-message',
  362. from: id,
  363. message: body,
  364. nick,
  365. stamp: ts
  366. });
  367. }
  368. /**
  369. * Notify external application (if API is enabled) that user joined the
  370. * conference.
  371. *
  372. * @param {string} id - User id.
  373. * @param {Object} props - The display name of the user.
  374. * @returns {void}
  375. */
  376. notifyUserJoined(id: string, props: Object) {
  377. this._sendEvent({
  378. name: 'participant-joined',
  379. id,
  380. ...props
  381. });
  382. }
  383. /**
  384. * Notify external application (if API is enabled) that user left the
  385. * conference.
  386. *
  387. * @param {string} id - User id.
  388. * @returns {void}
  389. */
  390. notifyUserLeft(id: string) {
  391. this._sendEvent({
  392. name: 'participant-left',
  393. id
  394. });
  395. }
  396. /**
  397. * Notify external application (if API is enabled) that user changed their
  398. * avatar.
  399. *
  400. * @param {string} id - User id.
  401. * @param {string} avatarURL - The new avatar URL of the participant.
  402. * @returns {void}
  403. */
  404. notifyAvatarChanged(id: string, avatarURL: string) {
  405. this._sendEvent({
  406. name: 'avatar-changed',
  407. avatarURL,
  408. id
  409. });
  410. }
  411. /**
  412. * Notify external application (if API is enabled) that user received
  413. * a text message through datachannels.
  414. *
  415. * @param {Object} data - The event data.
  416. * @returns {void}
  417. */
  418. notifyEndpointTextMessageReceived(data: Object) {
  419. this._sendEvent({
  420. name: 'endpoint-text-message-received',
  421. data
  422. });
  423. }
  424. /**
  425. * Notify external application (if API is enabled) that the device list has
  426. * changed.
  427. *
  428. * @param {Object} devices - The new device list.
  429. * @returns {void}
  430. */
  431. notifyDeviceListChanged(devices: Object) {
  432. this._sendEvent({
  433. name: 'device-list-changed',
  434. devices });
  435. }
  436. /**
  437. * Notify external application (if API is enabled) that user changed their
  438. * nickname.
  439. *
  440. * @param {string} id - User id.
  441. * @param {string} displayname - User nickname.
  442. * @param {string} formattedDisplayName - The display name shown in Jitsi
  443. * meet's UI for the user.
  444. * @returns {void}
  445. */
  446. notifyDisplayNameChanged(
  447. id: string,
  448. { displayName, formattedDisplayName }: Object) {
  449. this._sendEvent({
  450. name: 'display-name-change',
  451. displayname: displayName,
  452. formattedDisplayName,
  453. id
  454. });
  455. }
  456. /**
  457. * Notify external application (if API is enabled) that user changed their
  458. * email.
  459. *
  460. * @param {string} id - User id.
  461. * @param {string} email - The new email of the participant.
  462. * @returns {void}
  463. */
  464. notifyEmailChanged(
  465. id: string,
  466. { email }: Object) {
  467. this._sendEvent({
  468. name: 'email-change',
  469. email,
  470. id
  471. });
  472. }
  473. /**
  474. * Notify external application (if API is enabled) that the conference has
  475. * been joined.
  476. *
  477. * @param {string} roomName - The room name.
  478. * @param {string} id - The id of the local user.
  479. * @param {Object} props - The display name and avatar URL of the local
  480. * user.
  481. * @returns {void}
  482. */
  483. notifyConferenceJoined(roomName: string, id: string, props: Object) {
  484. this._sendEvent({
  485. name: 'video-conference-joined',
  486. roomName,
  487. id,
  488. ...props
  489. });
  490. }
  491. /**
  492. * Notify external application (if API is enabled) that user changed their
  493. * nickname.
  494. *
  495. * @param {string} roomName - User id.
  496. * @returns {void}
  497. */
  498. notifyConferenceLeft(roomName: string) {
  499. this._sendEvent({
  500. name: 'video-conference-left',
  501. roomName
  502. });
  503. }
  504. /**
  505. * Notify external application (if API is enabled) that we are ready to be
  506. * closed.
  507. *
  508. * @returns {void}
  509. */
  510. notifyReadyToClose() {
  511. this._sendEvent({ name: 'video-ready-to-close' });
  512. }
  513. /**
  514. * Notify external application (if API is enabled) that a suspend event in host computer.
  515. *
  516. * @returns {void}
  517. */
  518. notifySuspendDetected() {
  519. this._sendEvent({ name: 'suspend-detected' });
  520. }
  521. /**
  522. * Notify external application (if API is enabled) for audio muted status
  523. * changed.
  524. *
  525. * @param {boolean} muted - The new muted status.
  526. * @returns {void}
  527. */
  528. notifyAudioMutedStatusChanged(muted: boolean) {
  529. this._sendEvent({
  530. name: 'audio-mute-status-changed',
  531. muted
  532. });
  533. }
  534. /**
  535. * Notify external application (if API is enabled) for video muted status
  536. * changed.
  537. *
  538. * @param {boolean} muted - The new muted status.
  539. * @returns {void}
  540. */
  541. notifyVideoMutedStatusChanged(muted: boolean) {
  542. this._sendEvent({
  543. name: 'video-mute-status-changed',
  544. muted
  545. });
  546. }
  547. /**
  548. * Notify external application (if API is enabled) for audio availability
  549. * changed.
  550. *
  551. * @param {boolean} available - True if available and false otherwise.
  552. * @returns {void}
  553. */
  554. notifyAudioAvailabilityChanged(available: boolean) {
  555. audioAvailable = available;
  556. this._sendEvent({
  557. name: 'audio-availability-changed',
  558. available
  559. });
  560. }
  561. /**
  562. * Notify external application (if API is enabled) for video available
  563. * status changed.
  564. *
  565. * @param {boolean} available - True if available and false otherwise.
  566. * @returns {void}
  567. */
  568. notifyVideoAvailabilityChanged(available: boolean) {
  569. videoAvailable = available;
  570. this._sendEvent({
  571. name: 'video-availability-changed',
  572. available
  573. });
  574. }
  575. /**
  576. * Notify external application (if API is enabled) that the on stage
  577. * participant has changed.
  578. *
  579. * @param {string} id - User id of the new on stage participant.
  580. * @returns {void}
  581. */
  582. notifyOnStageParticipantChanged(id: string) {
  583. this._sendEvent({
  584. name: 'on-stage-participant-changed',
  585. id
  586. });
  587. }
  588. /**
  589. * Notify external application of an unexpected camera-related error having
  590. * occurred.
  591. *
  592. * @param {string} type - The type of the camera error.
  593. * @param {string} message - Additional information about the error.
  594. * @returns {void}
  595. */
  596. notifyOnCameraError(type: string, message: string) {
  597. this._sendEvent({
  598. name: 'camera-error',
  599. type,
  600. message
  601. });
  602. }
  603. /**
  604. * Notify external application of an unexpected mic-related error having
  605. * occurred.
  606. *
  607. * @param {string} type - The type of the mic error.
  608. * @param {string} message - Additional information about the error.
  609. * @returns {void}
  610. */
  611. notifyOnMicError(type: string, message: string) {
  612. this._sendEvent({
  613. name: 'mic-error',
  614. type,
  615. message
  616. });
  617. }
  618. /**
  619. * Notify external application (if API is enabled) that conference feedback
  620. * has been submitted. Intended to be used in conjunction with the
  621. * submit-feedback command to get notified if feedback was submitted.
  622. *
  623. * @param {string} error - A failure message, if any.
  624. * @returns {void}
  625. */
  626. notifyFeedbackSubmitted(error: string) {
  627. this._sendEvent({
  628. name: 'feedback-submitted',
  629. error
  630. });
  631. }
  632. /**
  633. * Notify external application (if API is enabled) that the feedback prompt
  634. * has been displayed.
  635. *
  636. * @returns {void}
  637. */
  638. notifyFeedbackPromptDisplayed() {
  639. this._sendEvent({ name: 'feedback-prompt-displayed' });
  640. }
  641. /**
  642. * Notify external application (if API is enabled) that the display
  643. * configuration of the filmstrip has been changed.
  644. *
  645. * @param {boolean} visible - Whether or not the filmstrip has been set to
  646. * be displayed or hidden.
  647. * @returns {void}
  648. */
  649. notifyFilmstripDisplayChanged(visible: boolean) {
  650. this._sendEvent({
  651. name: 'filmstrip-display-changed',
  652. visible
  653. });
  654. }
  655. /**
  656. * Notify external application of a participant, remote or local, being
  657. * removed from the conference by another participant.
  658. *
  659. * @param {string} kicked - The ID of the participant removed from the
  660. * conference.
  661. * @param {string} kicker - The ID of the participant that removed the
  662. * other participant.
  663. * @returns {void}
  664. */
  665. notifyKickedOut(kicked: Object, kicker: Object) {
  666. this._sendEvent({
  667. name: 'participant-kicked-out',
  668. kicked,
  669. kicker
  670. });
  671. }
  672. /**
  673. * Notify external application of the current meeting requiring a password
  674. * to join.
  675. *
  676. * @returns {void}
  677. */
  678. notifyOnPasswordRequired() {
  679. this._sendEvent({ name: 'password-required' });
  680. }
  681. /**
  682. * Notify external application (if API is enabled) that the screen sharing
  683. * has been turned on/off.
  684. *
  685. * @param {boolean} on - True if screen sharing is enabled.
  686. * @param {Object} details - Additional information about the screen
  687. * sharing.
  688. * @param {string} details.sourceType - Type of device or window the screen
  689. * share is capturing.
  690. * @returns {void}
  691. */
  692. notifyScreenSharingStatusChanged(on: boolean, details: Object) {
  693. this._sendEvent({
  694. name: 'screen-sharing-status-changed',
  695. on,
  696. details
  697. });
  698. }
  699. /**
  700. * Notify external application (if API is enabled) that the dominant speaker
  701. * has been turned on/off.
  702. *
  703. * @param {string} id - Id of the dominant participant.
  704. * @returns {void}
  705. */
  706. notifyDominantSpeakerChanged(id: string) {
  707. this._sendEvent({
  708. name: 'dominant-speaker-changed',
  709. id
  710. });
  711. }
  712. /**
  713. * Notify external application (if API is enabled) that the conference
  714. * changed their subject.
  715. *
  716. * @param {string} subject - Conference subject.
  717. * @returns {void}
  718. */
  719. notifySubjectChanged(subject: string) {
  720. this._sendEvent({
  721. name: 'subject-change',
  722. subject
  723. });
  724. }
  725. /**
  726. * Notify external application (if API is enabled) that tile view has been
  727. * entered or exited.
  728. *
  729. * @param {string} enabled - True if tile view is currently displayed, false
  730. * otherwise.
  731. * @returns {void}
  732. */
  733. notifyTileViewChanged(enabled: boolean) {
  734. this._sendEvent({
  735. name: 'tile-view-changed',
  736. enabled
  737. });
  738. }
  739. /**
  740. * Disposes the allocated resources.
  741. *
  742. * @returns {void}
  743. */
  744. dispose() {
  745. if (this._enabled) {
  746. this._enabled = false;
  747. APP.conference.removeListener(
  748. JitsiMeetConferenceEvents.DESKTOP_SHARING_ENABLED_CHANGED,
  749. onDesktopSharingEnabledChanged);
  750. }
  751. }
  752. }
  753. export default new API();