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

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