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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764
  1. /* global APP, $, config, interfaceConfig */
  2. const logger = require('jitsi-meet-logger').getLogger(__filename);
  3. const UI = {};
  4. import messageHandler from './util/MessageHandler';
  5. import UIUtil from './util/UIUtil';
  6. import UIEvents from '../../service/UI/UIEvents';
  7. import EtherpadManager from './etherpad/Etherpad';
  8. import SharedVideoManager from './shared_video/SharedVideo';
  9. import VideoLayout from './videolayout/VideoLayout';
  10. import { getLocalParticipant } from '../../react/features/base/participants';
  11. import { toggleChat } from '../../react/features/chat';
  12. import { setDocumentUrl } from '../../react/features/etherpad';
  13. import { setFilmstripVisible } from '../../react/features/filmstrip';
  14. import { joinLeaveNotificationsDisabled, setNotificationsEnabled } from '../../react/features/notifications';
  15. import {
  16. dockToolbox,
  17. setToolboxEnabled,
  18. showToolbox
  19. } from '../../react/features/toolbox';
  20. const EventEmitter = require('events');
  21. UI.messageHandler = messageHandler;
  22. const eventEmitter = new EventEmitter();
  23. UI.eventEmitter = eventEmitter;
  24. let etherpadManager;
  25. let sharedVideoManager;
  26. const UIListeners = new Map([
  27. [
  28. UIEvents.ETHERPAD_CLICKED,
  29. () => etherpadManager && etherpadManager.toggleEtherpad()
  30. ], [
  31. UIEvents.SHARED_VIDEO_CLICKED,
  32. () => sharedVideoManager && sharedVideoManager.toggleSharedVideo()
  33. ], [
  34. UIEvents.TOGGLE_FILMSTRIP,
  35. () => UI.toggleFilmstrip()
  36. ]
  37. ]);
  38. /**
  39. * Indicates if we're currently in full screen mode.
  40. *
  41. * @return {boolean} {true} to indicate that we're currently in full screen
  42. * mode, {false} otherwise
  43. */
  44. UI.isFullScreen = function() {
  45. return UIUtil.isFullScreen();
  46. };
  47. /**
  48. * Returns true if the etherpad window is currently visible.
  49. * @returns {Boolean} - true if the etherpad window is currently visible.
  50. */
  51. UI.isEtherpadVisible = function() {
  52. return Boolean(etherpadManager && etherpadManager.isVisible());
  53. };
  54. /**
  55. * Returns true if there is a shared video which is being shown (?).
  56. * @returns {boolean} - true if there is a shared video which is being shown.
  57. */
  58. UI.isSharedVideoShown = function() {
  59. return Boolean(sharedVideoManager && sharedVideoManager.isSharedVideoShown);
  60. };
  61. /**
  62. * Notify user that server has shut down.
  63. */
  64. UI.notifyGracefulShutdown = function() {
  65. messageHandler.showError({
  66. descriptionKey: 'dialog.gracefulShutdown',
  67. titleKey: 'dialog.serviceUnavailable'
  68. });
  69. };
  70. /**
  71. * Notify user that reservation error happened.
  72. */
  73. UI.notifyReservationError = function(code, msg) {
  74. messageHandler.showError({
  75. descriptionArguments: {
  76. code,
  77. msg
  78. },
  79. descriptionKey: 'dialog.reservationErrorMsg',
  80. titleKey: 'dialog.reservationError'
  81. });
  82. };
  83. /**
  84. * Notify user that conference was destroyed.
  85. * @param reason {string} the reason text
  86. */
  87. UI.notifyConferenceDestroyed = function(reason) {
  88. // FIXME: use Session Terminated from translation, but
  89. // 'reason' text comes from XMPP packet and is not translated
  90. messageHandler.showError({
  91. description: reason,
  92. titleKey: 'dialog.sessTerminated'
  93. });
  94. };
  95. /**
  96. * Change nickname for the user.
  97. * @param {string} id user id
  98. * @param {string} displayName new nickname
  99. */
  100. UI.changeDisplayName = function(id, displayName) {
  101. VideoLayout.onDisplayNameChanged(id, displayName);
  102. };
  103. /**
  104. * Initialize conference UI.
  105. */
  106. UI.initConference = function() {
  107. const { getState } = APP.store;
  108. const { id, name } = getLocalParticipant(getState);
  109. // Update default button states before showing the toolbar
  110. // if local role changes buttons state will be again updated.
  111. UI.updateLocalRole(APP.conference.isModerator);
  112. UI.showToolbar();
  113. const displayName = config.displayJids ? id : name;
  114. if (displayName) {
  115. UI.changeDisplayName('localVideoContainer', displayName);
  116. }
  117. };
  118. /**
  119. * Returns the shared document manager object.
  120. * @return {EtherpadManager} the shared document manager object
  121. */
  122. UI.getSharedVideoManager = function() {
  123. return sharedVideoManager;
  124. };
  125. /**
  126. * Starts the UI module and initializes all related components.
  127. *
  128. * @returns {boolean} true if the UI is ready and the conference should be
  129. * established, false - otherwise (for example in the case of welcome page)
  130. */
  131. UI.start = function() {
  132. // Set the defaults for prompt dialogs.
  133. $.prompt.setDefaults({ persistent: false });
  134. VideoLayout.init(eventEmitter);
  135. if (!interfaceConfig.filmStripOnly) {
  136. VideoLayout.initLargeVideo();
  137. }
  138. // Do not animate the video area on UI start (second argument passed into
  139. // resizeVideoArea) because the animation is not visible anyway. Plus with
  140. // the current dom layout, the quality label is part of the video layout and
  141. // will be seen animating in.
  142. VideoLayout.resizeVideoArea(true, false);
  143. sharedVideoManager = new SharedVideoManager(eventEmitter);
  144. if (interfaceConfig.filmStripOnly) {
  145. $('body').addClass('filmstrip-only');
  146. APP.store.dispatch(setNotificationsEnabled(false));
  147. } else if (config.iAmRecorder) {
  148. // in case of iAmSipGateway keep local video visible
  149. if (!config.iAmSipGateway) {
  150. VideoLayout.setLocalVideoVisible(false);
  151. APP.store.dispatch(setNotificationsEnabled(false));
  152. }
  153. APP.store.dispatch(setToolboxEnabled(false));
  154. UI.messageHandler.enablePopups(false);
  155. }
  156. };
  157. /**
  158. * Setup some UI event listeners.
  159. */
  160. UI.registerListeners
  161. = () => UIListeners.forEach((value, key) => UI.addListener(key, value));
  162. /**
  163. * Setup some DOM event listeners.
  164. */
  165. UI.bindEvents = () => {
  166. /**
  167. *
  168. */
  169. function onResize() {
  170. VideoLayout.onResize();
  171. }
  172. // Resize and reposition videos in full screen mode.
  173. $(document).on(
  174. 'webkitfullscreenchange mozfullscreenchange fullscreenchange',
  175. onResize);
  176. $(window).resize(onResize);
  177. };
  178. /**
  179. * Unbind some DOM event listeners.
  180. */
  181. UI.unbindEvents = () => {
  182. $(document).off(
  183. 'webkitfullscreenchange mozfullscreenchange fullscreenchange');
  184. $(window).off('resize');
  185. };
  186. /**
  187. * Show local video stream on UI.
  188. * @param {JitsiTrack} track stream to show
  189. */
  190. UI.addLocalVideoStream = track => {
  191. VideoLayout.changeLocalVideo(track);
  192. };
  193. /**
  194. * Setup and show Etherpad.
  195. * @param {string} name etherpad id
  196. */
  197. UI.initEtherpad = name => {
  198. if (etherpadManager || !config.etherpad_base || !name) {
  199. return;
  200. }
  201. logger.log('Etherpad is enabled');
  202. etherpadManager = new EtherpadManager(eventEmitter);
  203. const url = new URL(name, config.etherpad_base);
  204. APP.store.dispatch(setDocumentUrl(url.toString()));
  205. };
  206. /**
  207. * Returns the shared document manager object.
  208. * @return {EtherpadManager} the shared document manager object
  209. */
  210. UI.getSharedDocumentManager = () => etherpadManager;
  211. /**
  212. * Show user on UI.
  213. * @param {JitsiParticipant} user
  214. */
  215. UI.addUser = function(user) {
  216. const id = user.getId();
  217. const displayName = user.getDisplayName();
  218. const status = user.getStatus();
  219. if (status) {
  220. // FIXME: move updateUserStatus in participantPresenceChanged action
  221. UI.updateUserStatus(user, status);
  222. }
  223. // set initial display name
  224. if (displayName) {
  225. UI.changeDisplayName(id, displayName);
  226. }
  227. };
  228. /**
  229. * Update videotype for specified user.
  230. * @param {string} id user id
  231. * @param {string} newVideoType new videotype
  232. */
  233. UI.onPeerVideoTypeChanged
  234. = (id, newVideoType) => VideoLayout.onVideoTypeChanged(id, newVideoType);
  235. /**
  236. * Update local user role and show notification if user is moderator.
  237. * @param {boolean} isModerator if local user is moderator or not
  238. */
  239. UI.updateLocalRole = isModerator => {
  240. VideoLayout.showModeratorIndicator();
  241. if (isModerator && !interfaceConfig.DISABLE_FOCUS_INDICATOR) {
  242. messageHandler.participantNotification(
  243. null, 'notify.me', 'connected', 'notify.moderator');
  244. }
  245. };
  246. /**
  247. * Check the role for the user and reflect it in the UI, moderator ui indication
  248. * and notifies user who is the moderator
  249. * @param user to check for moderator
  250. */
  251. UI.updateUserRole = user => {
  252. VideoLayout.showModeratorIndicator();
  253. // We don't need to show moderator notifications when the focus (moderator)
  254. // indicator is disabled.
  255. if (!user.isModerator() || interfaceConfig.DISABLE_FOCUS_INDICATOR) {
  256. return;
  257. }
  258. const displayName = user.getDisplayName();
  259. messageHandler.participantNotification(
  260. displayName,
  261. 'notify.somebody',
  262. 'connected',
  263. 'notify.grantedTo',
  264. { to: displayName
  265. ? UIUtil.escapeHtml(displayName) : '$t(notify.somebody)' });
  266. };
  267. /**
  268. * Updates the user status.
  269. *
  270. * @param {JitsiParticipant} user - The user which status we need to update.
  271. * @param {string} status - The new status.
  272. */
  273. UI.updateUserStatus = (user, status) => {
  274. const reduxState = APP.store.getState() || {};
  275. const { calleeInfoVisible } = reduxState['features/invite'] || {};
  276. // We hide status updates when join/leave notifications are disabled,
  277. // as jigasi is the component with statuses and they are seen as join/leave notifications.
  278. if (!status || calleeInfoVisible || joinLeaveNotificationsDisabled()) {
  279. return;
  280. }
  281. const displayName = user.getDisplayName();
  282. messageHandler.participantNotification(
  283. displayName,
  284. '',
  285. 'connected',
  286. 'dialOut.statusMessage',
  287. { status: UIUtil.escapeHtml(status) });
  288. };
  289. /**
  290. * Toggles filmstrip.
  291. */
  292. UI.toggleFilmstrip = function() {
  293. const { visible } = APP.store.getState()['features/filmstrip'];
  294. APP.store.dispatch(setFilmstripVisible(!visible));
  295. };
  296. /**
  297. * Toggles the visibility of the chat panel.
  298. */
  299. UI.toggleChat = () => APP.store.dispatch(toggleChat());
  300. /**
  301. * Handle new user display name.
  302. */
  303. UI.inputDisplayNameHandler = function(newDisplayName) {
  304. eventEmitter.emit(UIEvents.NICKNAME_CHANGED, newDisplayName);
  305. };
  306. /**
  307. * Return the type of the remote video.
  308. * @param jid the jid for the remote video
  309. * @returns the video type video or screen.
  310. */
  311. UI.getRemoteVideoType = function(jid) {
  312. return VideoLayout.getRemoteVideoType(jid);
  313. };
  314. // FIXME check if someone user this
  315. UI.showLoginPopup = function(callback) {
  316. logger.log('password is required');
  317. const message
  318. = `<input name="username" type="text"
  319. placeholder="user@domain.net"
  320. class="input-control" autofocus>
  321. <input name="password" type="password"
  322. data-i18n="[placeholder]dialog.userPassword"
  323. class="input-control"
  324. placeholder="user password">`
  325. ;
  326. // eslint-disable-next-line max-params
  327. const submitFunction = (e, v, m, f) => {
  328. if (v && f.username && f.password) {
  329. callback(f.username, f.password);
  330. }
  331. };
  332. messageHandler.openTwoButtonDialog({
  333. titleKey: 'dialog.passwordRequired',
  334. msgString: message,
  335. leftButtonKey: 'dialog.Ok',
  336. submitFunction,
  337. focus: ':input:first'
  338. });
  339. };
  340. UI.askForNickname = function() {
  341. // eslint-disable-next-line no-alert
  342. return window.prompt('Your nickname (optional)');
  343. };
  344. /**
  345. * Sets muted audio state for participant
  346. */
  347. UI.setAudioMuted = function(id, muted) {
  348. VideoLayout.onAudioMute(id, muted);
  349. if (APP.conference.isLocalId(id)) {
  350. APP.conference.updateAudioIconEnabled();
  351. }
  352. };
  353. /**
  354. * Sets muted video state for participant
  355. */
  356. UI.setVideoMuted = function(id, muted) {
  357. VideoLayout.onVideoMute(id, muted);
  358. if (APP.conference.isLocalId(id)) {
  359. APP.conference.updateVideoIconEnabled();
  360. }
  361. };
  362. /**
  363. * Triggers an update of remote video and large video displays so they may pick
  364. * up any state changes that have occurred elsewhere.
  365. *
  366. * @returns {void}
  367. */
  368. UI.updateAllVideos = () => VideoLayout.updateAllVideos();
  369. /**
  370. * Adds a listener that would be notified on the given type of event.
  371. *
  372. * @param type the type of the event we're listening for
  373. * @param listener a function that would be called when notified
  374. */
  375. UI.addListener = function(type, listener) {
  376. eventEmitter.on(type, listener);
  377. };
  378. /**
  379. * Removes the all listeners for all events.
  380. *
  381. * @returns {void}
  382. */
  383. UI.removeAllListeners = function() {
  384. eventEmitter.removeAllListeners();
  385. };
  386. /**
  387. * Removes the given listener for the given type of event.
  388. *
  389. * @param type the type of the event we're listening for
  390. * @param listener the listener we want to remove
  391. */
  392. UI.removeListener = function(type, listener) {
  393. eventEmitter.removeListener(type, listener);
  394. };
  395. /**
  396. * Emits the event of given type by specifying the parameters in options.
  397. *
  398. * @param type the type of the event we're emitting
  399. * @param options the parameters for the event
  400. */
  401. UI.emitEvent = (type, ...options) => eventEmitter.emit(type, ...options);
  402. UI.clickOnVideo = videoNumber => VideoLayout.togglePin(videoNumber);
  403. // Used by torture.
  404. UI.showToolbar = timeout => APP.store.dispatch(showToolbox(timeout));
  405. // Used by torture.
  406. UI.dockToolbar = dock => APP.store.dispatch(dockToolbox(dock));
  407. /**
  408. * Updates the displayed avatar for participant.
  409. *
  410. * @param {string} id - User id whose avatar should be updated.
  411. * @param {string} avatarURL - The URL to avatar image to display.
  412. * @returns {void}
  413. */
  414. UI.refreshAvatarDisplay = function(id) {
  415. VideoLayout.changeUserAvatar(id);
  416. };
  417. /**
  418. * Notify user that connection failed.
  419. * @param {string} stropheErrorMsg raw Strophe error message
  420. */
  421. UI.notifyConnectionFailed = function(stropheErrorMsg) {
  422. let descriptionKey;
  423. let descriptionArguments;
  424. if (stropheErrorMsg) {
  425. descriptionKey = 'dialog.connectErrorWithMsg';
  426. descriptionArguments = { msg: stropheErrorMsg };
  427. } else {
  428. descriptionKey = 'dialog.connectError';
  429. }
  430. messageHandler.showError({
  431. descriptionArguments,
  432. descriptionKey,
  433. titleKey: 'connection.CONNFAIL'
  434. });
  435. };
  436. /**
  437. * Notify user that maximum users limit has been reached.
  438. */
  439. UI.notifyMaxUsersLimitReached = function() {
  440. messageHandler.showError({
  441. hideErrorSupportLink: true,
  442. descriptionKey: 'dialog.maxUsersLimitReached',
  443. titleKey: 'dialog.maxUsersLimitReachedTitle'
  444. });
  445. };
  446. /**
  447. * Notify user that he was automatically muted when joned the conference.
  448. */
  449. UI.notifyInitiallyMuted = function() {
  450. messageHandler.participantNotification(
  451. null,
  452. 'notify.mutedTitle',
  453. 'connected',
  454. 'notify.muted',
  455. null);
  456. };
  457. UI.handleLastNEndpoints = function(leavingIds, enteringIds) {
  458. VideoLayout.onLastNEndpointsChanged(leavingIds, enteringIds);
  459. };
  460. /**
  461. * Update audio level visualization for specified user.
  462. * @param {string} id user id
  463. * @param {number} lvl audio level
  464. */
  465. UI.setAudioLevel = (id, lvl) => VideoLayout.setAudioLevel(id, lvl);
  466. /**
  467. * Hide connection quality statistics from UI.
  468. */
  469. UI.hideStats = function() {
  470. VideoLayout.hideStats();
  471. };
  472. UI.notifyTokenAuthFailed = function() {
  473. messageHandler.showError({
  474. descriptionKey: 'dialog.tokenAuthFailed',
  475. titleKey: 'dialog.tokenAuthFailedTitle'
  476. });
  477. };
  478. UI.notifyInternalError = function(error) {
  479. messageHandler.showError({
  480. descriptionArguments: { error },
  481. descriptionKey: 'dialog.internalError',
  482. titleKey: 'dialog.internalErrorTitle'
  483. });
  484. };
  485. UI.notifyFocusDisconnected = function(focus, retrySec) {
  486. messageHandler.participantNotification(
  487. null, 'notify.focus',
  488. 'disconnected', 'notify.focusFail',
  489. { component: focus,
  490. ms: retrySec }
  491. );
  492. };
  493. /**
  494. * Notifies interested listeners that the raise hand property has changed.
  495. *
  496. * @param {boolean} isRaisedHand indicates the current state of the
  497. * "raised hand"
  498. */
  499. UI.onLocalRaiseHandChanged = function(isRaisedHand) {
  500. eventEmitter.emit(UIEvents.LOCAL_RAISE_HAND_CHANGED, isRaisedHand);
  501. };
  502. /**
  503. * Update list of available physical devices.
  504. */
  505. UI.onAvailableDevicesChanged = function() {
  506. APP.conference.updateAudioIconEnabled();
  507. APP.conference.updateVideoIconEnabled();
  508. };
  509. /**
  510. * Returns the id of the current video shown on large.
  511. * Currently used by tests (torture).
  512. */
  513. UI.getLargeVideoID = function() {
  514. return VideoLayout.getLargeVideoID();
  515. };
  516. /**
  517. * Returns the current video shown on large.
  518. * Currently used by tests (torture).
  519. */
  520. UI.getLargeVideo = function() {
  521. return VideoLayout.getLargeVideo();
  522. };
  523. /**
  524. * Shows "Please go to chrome webstore to install the desktop sharing extension"
  525. * 2 button dialog with buttons - cancel and go to web store.
  526. * @param url {string} the url of the extension.
  527. */
  528. UI.showExtensionExternalInstallationDialog = function(url) {
  529. let openedWindow = null;
  530. const submitFunction = function(e, v) {
  531. if (v) {
  532. e.preventDefault();
  533. if (openedWindow === null || openedWindow.closed) {
  534. openedWindow
  535. = window.open(
  536. url,
  537. 'extension_store_window',
  538. 'resizable,scrollbars=yes,status=1');
  539. } else {
  540. openedWindow.focus();
  541. }
  542. }
  543. };
  544. const closeFunction = function(e, v) {
  545. if (openedWindow) {
  546. // Ideally we would close the popup, but this does not seem to work
  547. // on Chrome. Leaving it uncommented in case it could work
  548. // in some version.
  549. openedWindow.close();
  550. openedWindow = null;
  551. }
  552. if (!v) {
  553. eventEmitter.emit(UIEvents.EXTERNAL_INSTALLATION_CANCELED);
  554. }
  555. };
  556. messageHandler.openTwoButtonDialog({
  557. titleKey: 'dialog.externalInstallationTitle',
  558. msgKey: 'dialog.externalInstallationMsg',
  559. leftButtonKey: 'dialog.goToStore',
  560. submitFunction,
  561. loadedFunction: $.noop,
  562. closeFunction
  563. });
  564. };
  565. /**
  566. * Shows a dialog which asks user to install the extension. This one is
  567. * displayed after installation is triggered from the script, but fails because
  568. * it must be initiated by user gesture.
  569. * @param callback {function} function to be executed after user clicks
  570. * the install button - it should make another attempt to install the extension.
  571. */
  572. UI.showExtensionInlineInstallationDialog = function(callback) {
  573. const submitFunction = function(e, v) {
  574. if (v) {
  575. callback();
  576. }
  577. };
  578. const closeFunction = function(e, v) {
  579. if (!v) {
  580. eventEmitter.emit(UIEvents.EXTERNAL_INSTALLATION_CANCELED);
  581. }
  582. };
  583. messageHandler.openTwoButtonDialog({
  584. titleKey: 'dialog.externalInstallationTitle',
  585. msgKey: 'dialog.inlineInstallationMsg',
  586. leftButtonKey: 'dialog.inlineInstallExtension',
  587. submitFunction,
  588. loadedFunction: $.noop,
  589. closeFunction
  590. });
  591. };
  592. /**
  593. * Show shared video.
  594. * @param {string} id the id of the sender of the command
  595. * @param {string} url video url
  596. * @param {string} attributes
  597. */
  598. UI.onSharedVideoStart = function(id, url, attributes) {
  599. if (sharedVideoManager) {
  600. sharedVideoManager.onSharedVideoStart(id, url, attributes);
  601. }
  602. };
  603. /**
  604. * Update shared video.
  605. * @param {string} id the id of the sender of the command
  606. * @param {string} url video url
  607. * @param {string} attributes
  608. */
  609. UI.onSharedVideoUpdate = function(id, url, attributes) {
  610. if (sharedVideoManager) {
  611. sharedVideoManager.onSharedVideoUpdate(id, url, attributes);
  612. }
  613. };
  614. /**
  615. * Stop showing shared video.
  616. * @param {string} id the id of the sender of the command
  617. * @param {string} attributes
  618. */
  619. UI.onSharedVideoStop = function(id, attributes) {
  620. if (sharedVideoManager) {
  621. sharedVideoManager.onSharedVideoStop(id, attributes);
  622. }
  623. };
  624. /**
  625. * Handles user's features changes.
  626. */
  627. UI.onUserFeaturesChanged = user => VideoLayout.onUserFeaturesChanged(user);
  628. /**
  629. * Returns the number of known remote videos.
  630. *
  631. * @returns {number} The number of remote videos.
  632. */
  633. UI.getRemoteVideosCount = () => VideoLayout.getRemoteVideosCount();
  634. /**
  635. * Sets the remote control active status for a remote participant.
  636. *
  637. * @param {string} participantID - The id of the remote participant.
  638. * @param {boolean} isActive - The new remote control active status.
  639. * @returns {void}
  640. */
  641. UI.setRemoteControlActiveStatus = function(participantID, isActive) {
  642. VideoLayout.setRemoteControlActiveStatus(participantID, isActive);
  643. };
  644. /**
  645. * Sets the remote control active status for the local participant.
  646. *
  647. * @returns {void}
  648. */
  649. UI.setLocalRemoteControlActiveChanged = function() {
  650. VideoLayout.setLocalRemoteControlActiveChanged();
  651. };
  652. // TODO: Export every function separately. For now there is no point of doing
  653. // this because we are importing everything.
  654. export default UI;