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.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384
  1. /* global APP, JitsiMeetJS, $, config, interfaceConfig, toastr */
  2. const logger = require("jitsi-meet-logger").getLogger(__filename);
  3. var UI = {};
  4. import {
  5. updateDeviceList
  6. } from '../../react/features/base/devices';
  7. import Chat from "./side_pannels/chat/Chat";
  8. import SidePanels from "./side_pannels/SidePanels";
  9. import Avatar from "./avatar/Avatar";
  10. import SideContainerToggler from "./side_pannels/SideContainerToggler";
  11. import UIUtil from "./util/UIUtil";
  12. import UIEvents from "../../service/UI/UIEvents";
  13. import EtherpadManager from './etherpad/Etherpad';
  14. import SharedVideoManager from './shared_video/SharedVideo';
  15. import Recording from "./recording/Recording";
  16. import VideoLayout from "./videolayout/VideoLayout";
  17. import FilmStrip from "./videolayout/FilmStrip";
  18. import SettingsMenu from "./side_pannels/settings/SettingsMenu";
  19. import Profile from "./side_pannels/profile/Profile";
  20. import Settings from "./../settings/Settings";
  21. import RingOverlay from "./ring_overlay/RingOverlay";
  22. import UIErrors from './UIErrors';
  23. import { debounce } from "../util/helpers";
  24. import {
  25. setAudioMuted,
  26. setVideoMuted
  27. } from '../../react/features/base/media';
  28. import {
  29. checkAutoEnableDesktopSharing,
  30. dockToolbox,
  31. setAudioIconEnabled,
  32. setToolbarButton,
  33. setVideoIconEnabled,
  34. showDialPadButton,
  35. showEtherpadButton,
  36. showSharedVideoButton,
  37. showSIPCallButton,
  38. showToolbox
  39. } from '../../react/features/toolbox';
  40. var EventEmitter = require("events");
  41. UI.messageHandler = require("./util/MessageHandler");
  42. var messageHandler = UI.messageHandler;
  43. var JitsiPopover = require("./util/JitsiPopover");
  44. import Feedback from "./feedback/Feedback";
  45. import FollowMe from "../FollowMe";
  46. var eventEmitter = new EventEmitter();
  47. UI.eventEmitter = eventEmitter;
  48. /**
  49. * Whether an overlay is visible or not.
  50. *
  51. * FIXME: This is temporary solution. Don't use this variable!
  52. * Should be removed when all the code is move to react.
  53. *
  54. * @type {boolean}
  55. * @public
  56. */
  57. UI.overlayVisible = false;
  58. let etherpadManager;
  59. let sharedVideoManager;
  60. let followMeHandler;
  61. let deviceErrorDialog;
  62. const TrackErrors = JitsiMeetJS.errors.track;
  63. const JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP = {
  64. microphone: {},
  65. camera: {}
  66. };
  67. JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.UNSUPPORTED_RESOLUTION]
  68. = "dialog.cameraUnsupportedResolutionError";
  69. JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.GENERAL]
  70. = "dialog.cameraUnknownError";
  71. JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.PERMISSION_DENIED]
  72. = "dialog.cameraPermissionDeniedError";
  73. JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.NOT_FOUND]
  74. = "dialog.cameraNotFoundError";
  75. JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.CONSTRAINT_FAILED]
  76. = "dialog.cameraConstraintFailedError";
  77. JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.NO_DATA_FROM_SOURCE]
  78. = "dialog.cameraNotSendingData";
  79. JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.GENERAL]
  80. = "dialog.micUnknownError";
  81. JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.PERMISSION_DENIED]
  82. = "dialog.micPermissionDeniedError";
  83. JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.NOT_FOUND]
  84. = "dialog.micNotFoundError";
  85. JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.CONSTRAINT_FAILED]
  86. = "dialog.micConstraintFailedError";
  87. JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.NO_DATA_FROM_SOURCE]
  88. = "dialog.micNotSendingData";
  89. /**
  90. * Toggles the application in and out of full screen mode
  91. * (a.k.a. presentation mode in Chrome).
  92. */
  93. UI.toggleFullScreen = function() {
  94. (UIUtil.isFullScreen())
  95. ? UIUtil.exitFullScreen()
  96. : UIUtil.enterFullScreen();
  97. };
  98. /**
  99. * Notify user that server has shut down.
  100. */
  101. UI.notifyGracefulShutdown = function () {
  102. messageHandler.openMessageDialog(
  103. 'dialog.serviceUnavailable',
  104. 'dialog.gracefulShutdown'
  105. );
  106. };
  107. /**
  108. * Notify user that reservation error happened.
  109. */
  110. UI.notifyReservationError = function (code, msg) {
  111. var message = APP.translation.generateTranslationHTML(
  112. "dialog.reservationErrorMsg", {code: code, msg: msg});
  113. messageHandler.openDialog(
  114. "dialog.reservationError", message, true, {}, () => false);
  115. };
  116. /**
  117. * Notify user that he has been kicked from the server.
  118. */
  119. UI.notifyKicked = function () {
  120. messageHandler.openMessageDialog(
  121. "dialog.sessTerminated",
  122. "dialog.kickMessage");
  123. };
  124. /**
  125. * Notify user that conference was destroyed.
  126. * @param reason {string} the reason text
  127. */
  128. UI.notifyConferenceDestroyed = function (reason) {
  129. //FIXME: use Session Terminated from translation, but
  130. // 'reason' text comes from XMPP packet and is not translated
  131. messageHandler.openDialog(
  132. "dialog.sessTerminated", reason, true, {}, () => false);
  133. };
  134. /**
  135. * Show chat error.
  136. * @param err the Error
  137. * @param msg
  138. */
  139. UI.showChatError = function (err, msg) {
  140. if (interfaceConfig.filmStripOnly) {
  141. return;
  142. }
  143. Chat.chatAddError(err, msg);
  144. };
  145. /**
  146. * Change nickname for the user.
  147. * @param {string} id user id
  148. * @param {string} displayName new nickname
  149. */
  150. UI.changeDisplayName = function (id, displayName) {
  151. if (UI.ContactList)
  152. UI.ContactList.onDisplayNameChange(id, displayName);
  153. VideoLayout.onDisplayNameChanged(id, displayName);
  154. if (APP.conference.isLocalId(id) || id === 'localVideoContainer') {
  155. Profile.changeDisplayName(displayName);
  156. Chat.setChatConversationMode(!!displayName);
  157. }
  158. };
  159. /**
  160. * Shows/hides the indication about local connection being interrupted.
  161. *
  162. * @param {boolean} isInterrupted <tt>true</tt> if local connection is
  163. * currently in the interrupted state or <tt>false</tt> if the connection
  164. * is fine.
  165. */
  166. UI.showLocalConnectionInterrupted = function (isInterrupted) {
  167. VideoLayout.showLocalConnectionInterrupted(isInterrupted);
  168. };
  169. /**
  170. * Sets the "raised hand" status for a participant.
  171. */
  172. UI.setRaisedHandStatus = (participant, raisedHandStatus) => {
  173. VideoLayout.setRaisedHandStatus(participant.getId(), raisedHandStatus);
  174. if (raisedHandStatus) {
  175. messageHandler.notify(participant.getDisplayName(), 'notify.somebody',
  176. 'connected', 'notify.raisedHand');
  177. }
  178. };
  179. /**
  180. * Sets the local "raised hand" status.
  181. */
  182. UI.setLocalRaisedHandStatus
  183. = raisedHandStatus =>
  184. VideoLayout.setRaisedHandStatus(
  185. APP.conference.getMyUserId(),
  186. raisedHandStatus);
  187. /**
  188. * Initialize conference UI.
  189. */
  190. UI.initConference = function () {
  191. let id = APP.conference.getMyUserId();
  192. // Add myself to the contact list.
  193. if (UI.ContactList)
  194. UI.ContactList.addContact(id, true);
  195. // Update default button states before showing the toolbar
  196. // if local role changes buttons state will be again updated.
  197. UI.updateLocalRole(APP.conference.isModerator);
  198. UI.showToolbar();
  199. let displayName = config.displayJids ? id : Settings.getDisplayName();
  200. if (displayName) {
  201. UI.changeDisplayName('localVideoContainer', displayName);
  202. }
  203. // Make sure we configure our avatar id, before creating avatar for us
  204. let email = Settings.getEmail();
  205. if (email) {
  206. UI.setUserEmail(id, email);
  207. } else {
  208. UI.setUserAvatarID(id, Settings.getAvatarId());
  209. }
  210. APP.store.dispatch(checkAutoEnableDesktopSharing());
  211. if(!interfaceConfig.filmStripOnly) {
  212. Feedback.init(eventEmitter);
  213. }
  214. // FollowMe attempts to copy certain aspects of the moderator's UI into the
  215. // other participants' UI. Consequently, it needs (1) read and write access
  216. // to the UI (depending on the moderator role of the local participant) and
  217. // (2) APP.conference as means of communication between the participants.
  218. followMeHandler = new FollowMe(APP.conference, UI);
  219. UIUtil.activateTooltips();
  220. };
  221. UI.mucJoined = function () {
  222. VideoLayout.mucJoined();
  223. };
  224. /***
  225. * Handler for toggling filmstrip
  226. */
  227. UI.handleToggleFilmStrip = () => UI.toggleFilmStrip();
  228. /**
  229. * Sets tooltip defaults.
  230. *
  231. * @private
  232. */
  233. function _setTooltipDefaults() {
  234. $.fn.tooltip.defaults = {
  235. opacity: 1, //defaults to 1
  236. offset: 1,
  237. delayIn: 0, //defaults to 500
  238. hoverable: true,
  239. hideOnClick: true,
  240. aria: true
  241. };
  242. }
  243. /**
  244. * Returns the shared document manager object.
  245. * @return {EtherpadManager} the shared document manager object
  246. */
  247. UI.getSharedVideoManager = function () {
  248. return sharedVideoManager;
  249. };
  250. /**
  251. * Starts the UI module and initializes all related components.
  252. *
  253. * @returns {boolean} true if the UI is ready and the conference should be
  254. * esablished, false - otherwise (for example in the case of welcome page)
  255. */
  256. UI.start = function () {
  257. document.title = interfaceConfig.APP_NAME;
  258. // Set the defaults for prompt dialogs.
  259. $.prompt.setDefaults({persistent: false});
  260. // Set the defaults for tooltips.
  261. _setTooltipDefaults();
  262. SideContainerToggler.init(eventEmitter);
  263. FilmStrip.init(eventEmitter);
  264. VideoLayout.init(eventEmitter);
  265. if (!interfaceConfig.filmStripOnly) {
  266. VideoLayout.initLargeVideo();
  267. }
  268. VideoLayout.resizeVideoArea(true, true);
  269. sharedVideoManager = new SharedVideoManager(eventEmitter);
  270. if (!interfaceConfig.filmStripOnly) {
  271. let debouncedShowToolbar
  272. = debounce(
  273. () => UI.showToolbar(),
  274. 100,
  275. { leading: true, trailing: false });
  276. $("#videoconference_page").mousemove(debouncedShowToolbar);
  277. // Initialize side panels
  278. SidePanels.init(eventEmitter);
  279. } else {
  280. $("body").addClass("filmstrip-only");
  281. UI.showToolbar();
  282. FilmStrip.setFilmStripOnly();
  283. messageHandler.enableNotifications(false);
  284. JitsiPopover.enabled = false;
  285. }
  286. document.title = interfaceConfig.APP_NAME;
  287. if (!interfaceConfig.filmStripOnly) {
  288. toastr.options = {
  289. "closeButton": true,
  290. "debug": false,
  291. "positionClass": "notification-bottom-right",
  292. "onclick": null,
  293. "showDuration": "300",
  294. "hideDuration": "1000",
  295. "timeOut": "2000",
  296. "extendedTimeOut": "1000",
  297. "showEasing": "swing",
  298. "hideEasing": "linear",
  299. "showMethod": "fadeIn",
  300. "hideMethod": "fadeOut",
  301. "newestOnTop": false,
  302. // this is the default toastr close button html, just adds tabIndex
  303. "closeHtml": '<button type="button" tabIndex="-1">&times;</button>'
  304. };
  305. }
  306. if(APP.tokenData.callee) {
  307. UI.showRingOverlay();
  308. }
  309. };
  310. /**
  311. * Setup some UI event listeners.
  312. */
  313. UI.registerListeners
  314. = () => UIListeners.forEach((value, key) => UI.addListener(key, value));
  315. /**
  316. * Unregister some UI event listeners.
  317. */
  318. UI.unregisterListeners
  319. = () => UIListeners.forEach((value, key) => UI.removeListener(key, value));
  320. /**
  321. * Setup some DOM event listeners.
  322. */
  323. UI.bindEvents = () => {
  324. function onResize() {
  325. SideContainerToggler.resize();
  326. VideoLayout.resizeVideoArea();
  327. }
  328. // Resize and reposition videos in full screen mode.
  329. $(document).on(
  330. 'webkitfullscreenchange mozfullscreenchange fullscreenchange',
  331. () => {
  332. eventEmitter.emit(
  333. UIEvents.FULLSCREEN_TOGGLED,
  334. UIUtil.isFullScreen());
  335. onResize();
  336. });
  337. $(window).resize(onResize);
  338. };
  339. /**
  340. * Unbind some DOM event listeners.
  341. */
  342. UI.unbindEvents = () => {
  343. $(document).off(
  344. 'webkitfullscreenchange mozfullscreenchange fullscreenchange');
  345. $(window).off('resize');
  346. };
  347. /**
  348. * Show local stream on UI.
  349. * @param {JitsiTrack} track stream to show
  350. */
  351. UI.addLocalStream = track => {
  352. switch (track.getType()) {
  353. case 'audio':
  354. VideoLayout.changeLocalAudio(track);
  355. break;
  356. case 'video':
  357. VideoLayout.changeLocalVideo(track);
  358. break;
  359. default:
  360. logger.error("Unknown stream type: " + track.getType());
  361. break;
  362. }
  363. };
  364. /**
  365. * Show remote stream on UI.
  366. * @param {JitsiTrack} track stream to show
  367. */
  368. UI.addRemoteStream = track => VideoLayout.onRemoteStreamAdded(track);
  369. /**
  370. * Removed remote stream from UI.
  371. * @param {JitsiTrack} track stream to remove
  372. */
  373. UI.removeRemoteStream = track => VideoLayout.onRemoteStreamRemoved(track);
  374. /**
  375. * Update chat subject.
  376. * @param {string} subject new chat subject
  377. */
  378. UI.setSubject = subject => Chat.setSubject(subject);
  379. /**
  380. * Setup and show Etherpad.
  381. * @param {string} name etherpad id
  382. */
  383. UI.initEtherpad = name => {
  384. if (etherpadManager || !config.etherpad_base || !name) {
  385. return;
  386. }
  387. logger.log('Etherpad is enabled');
  388. etherpadManager
  389. = new EtherpadManager(config.etherpad_base, name, eventEmitter);
  390. APP.store.dispatch(showEtherpadButton());
  391. };
  392. /**
  393. * Returns the shared document manager object.
  394. * @return {EtherpadManager} the shared document manager object
  395. */
  396. UI.getSharedDocumentManager = () => etherpadManager;
  397. /**
  398. * Show user on UI.
  399. * @param {JitsiParticipant} user
  400. */
  401. UI.addUser = function (user) {
  402. var id = user.getId();
  403. var displayName = user.getDisplayName();
  404. UI.hideRingOverLay();
  405. if (UI.ContactList)
  406. UI.ContactList.addContact(id);
  407. messageHandler.notify(
  408. displayName,'notify.somebody', 'connected', 'notify.connected'
  409. );
  410. if (!config.startAudioMuted ||
  411. config.startAudioMuted > APP.conference.membersCount)
  412. UIUtil.playSoundNotification('userJoined');
  413. // Add Peer's container
  414. VideoLayout.addParticipantContainer(user);
  415. // Configure avatar
  416. UI.setUserEmail(id);
  417. // set initial display name
  418. if(displayName)
  419. UI.changeDisplayName(id, displayName);
  420. };
  421. /**
  422. * Remove user from UI.
  423. * @param {string} id user id
  424. * @param {string} displayName user nickname
  425. */
  426. UI.removeUser = function (id, displayName) {
  427. if (UI.ContactList)
  428. UI.ContactList.removeContact(id);
  429. messageHandler.notify(
  430. displayName,'notify.somebody', 'disconnected', 'notify.disconnected'
  431. );
  432. if (!config.startAudioMuted
  433. || config.startAudioMuted > APP.conference.membersCount) {
  434. UIUtil.playSoundNotification('userLeft');
  435. }
  436. VideoLayout.removeParticipantContainer(id);
  437. };
  438. /**
  439. * Update videotype for specified user.
  440. * @param {string} id user id
  441. * @param {string} newVideoType new videotype
  442. */
  443. UI.onPeerVideoTypeChanged
  444. = (id, newVideoType) => VideoLayout.onVideoTypeChanged(id, newVideoType);
  445. /**
  446. * Update local user role and show notification if user is moderator.
  447. * @param {boolean} isModerator if local user is moderator or not
  448. */
  449. UI.updateLocalRole = isModerator => {
  450. VideoLayout.showModeratorIndicator();
  451. APP.store.dispatch(showSIPCallButton(isModerator));
  452. APP.store.dispatch(showSharedVideoButton());
  453. Recording.showRecordingButton(isModerator);
  454. SettingsMenu.showStartMutedOptions(isModerator);
  455. SettingsMenu.showFollowMeOptions(isModerator);
  456. if (isModerator) {
  457. if (!interfaceConfig.DISABLE_FOCUS_INDICATOR)
  458. messageHandler
  459. .notify(null, "notify.me", 'connected', "notify.moderator");
  460. Recording.checkAutoRecord();
  461. }
  462. };
  463. /**
  464. * Check the role for the user and reflect it in the UI, moderator ui indication
  465. * and notifies user who is the moderator
  466. * @param user to check for moderator
  467. */
  468. UI.updateUserRole = user => {
  469. VideoLayout.showModeratorIndicator();
  470. // We don't need to show moderator notifications when the focus (moderator)
  471. // indicator is disabled.
  472. if (!user.isModerator() || interfaceConfig.DISABLE_FOCUS_INDICATOR) {
  473. return;
  474. }
  475. var displayName = user.getDisplayName();
  476. if (displayName) {
  477. messageHandler.notify(
  478. displayName, 'notify.somebody',
  479. 'connected', 'notify.grantedTo', {
  480. to: UIUtil.escapeHtml(displayName)
  481. }
  482. );
  483. } else {
  484. messageHandler.notify(
  485. '', 'notify.somebody',
  486. 'connected', 'notify.grantedToUnknown');
  487. }
  488. };
  489. /**
  490. * Toggles smileys in the chat.
  491. */
  492. UI.toggleSmileys = () => Chat.toggleSmileys();
  493. /**
  494. * Toggles film strip.
  495. */
  496. UI.toggleFilmStrip = function () {
  497. var self = FilmStrip;
  498. self.toggleFilmStrip.apply(self, arguments);
  499. VideoLayout.resizeVideoArea(true, false);
  500. };
  501. /**
  502. * Indicates if the film strip is currently visible or not.
  503. * @returns {true} if the film strip is currently visible, otherwise
  504. */
  505. UI.isFilmStripVisible = () => FilmStrip.isFilmStripVisible();
  506. /**
  507. * Toggles chat panel.
  508. */
  509. UI.toggleChat = () => UI.toggleSidePanel("chat_container");
  510. /**
  511. * Toggles contact list panel.
  512. */
  513. UI.toggleContactList = () => UI.toggleSidePanel("contacts_container");
  514. /**
  515. * Toggles the given side panel.
  516. *
  517. * @param {String} sidePanelId the identifier of the side panel to toggle
  518. */
  519. UI.toggleSidePanel = sidePanelId => SideContainerToggler.toggle(sidePanelId);
  520. /**
  521. * Handle new user display name.
  522. */
  523. UI.inputDisplayNameHandler = function (newDisplayName) {
  524. eventEmitter.emit(UIEvents.NICKNAME_CHANGED, newDisplayName);
  525. };
  526. /**
  527. * Show custom popup/tooltip for a specified button.
  528. * @param popupSelectorID the selector id of the popup to show
  529. * @param show true or false/show or hide the popup
  530. * @param timeout the time to show the popup
  531. */
  532. UI.showCustomToolbarPopup = function (popupSelectorID, show, timeout) {
  533. eventEmitter.emit(UIEvents.SHOW_CUSTOM_TOOLBAR_BUTTON_POPUP,
  534. popupSelectorID, show, timeout);
  535. };
  536. /**
  537. * Return the type of the remote video.
  538. * @param jid the jid for the remote video
  539. * @returns the video type video or screen.
  540. */
  541. UI.getRemoteVideoType = function (jid) {
  542. return VideoLayout.getRemoteVideoType(jid);
  543. };
  544. UI.connectionIndicatorShowMore = function(id) {
  545. VideoLayout.showMore(id);
  546. return false;
  547. };
  548. // FIXME check if someone user this
  549. UI.showLoginPopup = function(callback) {
  550. logger.log('password is required');
  551. let message = (
  552. `<input name="username" type="text"
  553. placeholder="user@domain.net"
  554. class="input-control" autofocus>
  555. <input name="password" type="password"
  556. data-i18n="[placeholder]dialog.userPassword"
  557. class="input-control"
  558. placeholder="user password">`
  559. );
  560. let submitFunction = (e, v, m, f) => {
  561. if (v) {
  562. if (f.username && f.password) {
  563. callback(f.username, f.password);
  564. }
  565. }
  566. };
  567. messageHandler.openTwoButtonDialog({
  568. titleKey : "dialog.passwordRequired",
  569. msgString: message,
  570. leftButtonKey: 'dialog.Ok',
  571. submitFunction,
  572. focus: ':input:first'
  573. });
  574. };
  575. UI.askForNickname = function () {
  576. return window.prompt('Your nickname (optional)');
  577. };
  578. /**
  579. * Sets muted audio state for participant
  580. */
  581. UI.setAudioMuted = function (id, muted) {
  582. VideoLayout.onAudioMute(id, muted);
  583. if (APP.conference.isLocalId(id)) {
  584. APP.store.dispatch(setAudioMuted(muted));
  585. APP.store.dispatch(setToolbarButton('microphone', {
  586. toggled: muted
  587. }));
  588. }
  589. };
  590. /**
  591. * Sets muted video state for participant
  592. */
  593. UI.setVideoMuted = function (id, muted) {
  594. VideoLayout.onVideoMute(id, muted);
  595. if (APP.conference.isLocalId(id)) {
  596. APP.store.dispatch(setVideoMuted(muted));
  597. APP.store.dispatch(setToolbarButton('camera', {
  598. toggled: muted
  599. }));
  600. }
  601. };
  602. /**
  603. * Adds a listener that would be notified on the given type of event.
  604. *
  605. * @param type the type of the event we're listening for
  606. * @param listener a function that would be called when notified
  607. */
  608. UI.addListener = function (type, listener) {
  609. eventEmitter.on(type, listener);
  610. };
  611. /**
  612. * Removes the given listener for the given type of event.
  613. *
  614. * @param type the type of the event we're listening for
  615. * @param listener the listener we want to remove
  616. */
  617. UI.removeListener = function (type, listener) {
  618. eventEmitter.removeListener(type, listener);
  619. };
  620. /**
  621. * Emits the event of given type by specifying the parameters in options.
  622. *
  623. * @param type the type of the event we're emitting
  624. * @param options the parameters for the event
  625. */
  626. UI.emitEvent = (type, ...options) => eventEmitter.emit(type, ...options);
  627. UI.clickOnVideo = function (videoNumber) {
  628. let videos = $("#remoteVideos .videocontainer:not(#mixedstream)");
  629. let videosLength = videos.length;
  630. if(videosLength <= videoNumber) {
  631. return;
  632. }
  633. let videoIndex = videoNumber === 0 ? 0 : videosLength - videoNumber;
  634. videos[videoIndex].click();
  635. };
  636. // Used by torture.
  637. UI.showToolbar = timeout => APP.store.dispatch(showToolbox(timeout));
  638. // Used by torture.
  639. UI.dockToolbar = dock => APP.store.dispatch(dockToolbox(dock));
  640. /**
  641. * Updates the avatar for participant.
  642. * @param {string} id user id
  643. * @param {string} avatarUrl the URL for the avatar
  644. */
  645. function changeAvatar(id, avatarUrl) {
  646. VideoLayout.changeUserAvatar(id, avatarUrl);
  647. if (UI.ContactList)
  648. UI.ContactList.changeUserAvatar(id, avatarUrl);
  649. if (APP.conference.isLocalId(id)) {
  650. Profile.changeAvatar(avatarUrl);
  651. }
  652. }
  653. /**
  654. * Update user email.
  655. * @param {string} id user id
  656. * @param {string} email user email
  657. */
  658. UI.setUserEmail = function (id, email) {
  659. // update avatar
  660. Avatar.setUserEmail(id, email);
  661. changeAvatar(id, Avatar.getAvatarUrl(id));
  662. if (APP.conference.isLocalId(id)) {
  663. Profile.changeEmail(email);
  664. }
  665. };
  666. /**
  667. * Update user avtar id.
  668. * @param {string} id user id
  669. * @param {string} avatarId user's avatar id
  670. */
  671. UI.setUserAvatarID = function (id, avatarId) {
  672. // update avatar
  673. Avatar.setUserAvatarID(id, avatarId);
  674. changeAvatar(id, Avatar.getAvatarUrl(id));
  675. };
  676. /**
  677. * Update user avatar URL.
  678. * @param {string} id user id
  679. * @param {string} url user avatar url
  680. */
  681. UI.setUserAvatarUrl = function (id, url) {
  682. // update avatar
  683. Avatar.setUserAvatarUrl(id, url);
  684. changeAvatar(id, Avatar.getAvatarUrl(id));
  685. };
  686. /**
  687. * Notify user that connection failed.
  688. * @param {string} stropheErrorMsg raw Strophe error message
  689. */
  690. UI.notifyConnectionFailed = function (stropheErrorMsg) {
  691. var message;
  692. if (stropheErrorMsg) {
  693. message = APP.translation.generateTranslationHTML(
  694. "dialog.connectErrorWithMsg", {msg: stropheErrorMsg});
  695. } else {
  696. message = APP.translation.generateTranslationHTML(
  697. "dialog.connectError");
  698. }
  699. messageHandler.openDialog("dialog.error", message, true, {}, () => false);
  700. };
  701. /**
  702. * Notify user that maximum users limit has been reached.
  703. */
  704. UI.notifyMaxUsersLimitReached = function () {
  705. var message = APP.translation.generateTranslationHTML(
  706. "dialog.maxUsersLimitReached");
  707. messageHandler.openDialog("dialog.error", message, true, {}, () => false);
  708. };
  709. /**
  710. * Notify user that he was automatically muted when joned the conference.
  711. */
  712. UI.notifyInitiallyMuted = function () {
  713. messageHandler.notify(
  714. null,
  715. "notify.mutedTitle",
  716. "connected",
  717. "notify.muted",
  718. null,
  719. { timeOut: 120000 });
  720. };
  721. /**
  722. * Mark user as dominant speaker.
  723. * @param {string} id user id
  724. */
  725. UI.markDominantSpeaker = function (id) {
  726. VideoLayout.onDominantSpeakerChanged(id);
  727. };
  728. UI.handleLastNEndpoints = function (leavingIds, enteringIds) {
  729. VideoLayout.onLastNEndpointsChanged(leavingIds, enteringIds);
  730. };
  731. /**
  732. * Will handle notification about participant's connectivity status change.
  733. *
  734. * @param {string} id the id of remote participant(MUC jid)
  735. */
  736. UI.participantConnectionStatusChanged = function (id) {
  737. VideoLayout.onParticipantConnectionStatusChanged(id);
  738. };
  739. /**
  740. * Prompt user for nickname.
  741. */
  742. UI.promptDisplayName = () => {
  743. const labelKey = 'dialog.enterDisplayName';
  744. const message = (
  745. `<div class="form-control">
  746. <label data-i18n="${labelKey}" class="form-control__label"></label>
  747. <input name="displayName" type="text"
  748. data-i18n="[placeholder]defaultNickname"
  749. class="input-control" autofocus>
  750. </div>`
  751. );
  752. // Don't use a translation string, because we're too early in the call and
  753. // the translation may not be initialised.
  754. const buttons = { Ok: true };
  755. const dialog = messageHandler.openDialog(
  756. 'dialog.displayNameRequired',
  757. message,
  758. true,
  759. buttons,
  760. (e, v, m, f) => {
  761. e.preventDefault();
  762. if (v) {
  763. const displayName = f.displayName;
  764. if (displayName) {
  765. UI.inputDisplayNameHandler(displayName);
  766. dialog.close();
  767. return;
  768. }
  769. }
  770. },
  771. () => {
  772. const form = $.prompt.getPrompt();
  773. const input = form.find("input[name='displayName']");
  774. const button = form.find("button");
  775. input.focus();
  776. button.attr("disabled", "disabled");
  777. input.keyup(() => {
  778. if (input.val()) {
  779. button.removeAttr("disabled");
  780. } else {
  781. button.attr("disabled", "disabled");
  782. }
  783. });
  784. }
  785. );
  786. };
  787. /**
  788. * Update audio level visualization for specified user.
  789. * @param {string} id user id
  790. * @param {number} lvl audio level
  791. */
  792. UI.setAudioLevel = (id, lvl) => VideoLayout.setAudioLevel(id, lvl);
  793. /**
  794. * Update state of desktop sharing buttons.
  795. *
  796. * @returns {void}
  797. */
  798. UI.updateDesktopSharingButtons
  799. = () =>
  800. APP.store.dispatch(setToolbarButton('desktop', {
  801. toggled: APP.conference.isSharingScreen
  802. }));
  803. /**
  804. * Hide connection quality statistics from UI.
  805. */
  806. UI.hideStats = function () {
  807. VideoLayout.hideStats();
  808. };
  809. /**
  810. * Update local connection quality statistics.
  811. * @param {number} percent
  812. * @param {object} stats
  813. */
  814. UI.updateLocalStats = function (percent, stats) {
  815. VideoLayout.updateLocalConnectionStats(percent, stats);
  816. };
  817. /**
  818. * Update connection quality statistics for remote user.
  819. * @param {string} id user id
  820. * @param {number} percent
  821. * @param {object} stats
  822. */
  823. UI.updateRemoteStats = function (id, percent, stats) {
  824. VideoLayout.updateConnectionStats(id, percent, stats);
  825. };
  826. /**
  827. * Mark video as interrupted or not.
  828. * @param {boolean} interrupted if video is interrupted
  829. */
  830. UI.markVideoInterrupted = function (interrupted) {
  831. if (interrupted) {
  832. VideoLayout.onVideoInterrupted();
  833. } else {
  834. VideoLayout.onVideoRestored();
  835. }
  836. };
  837. /**
  838. * Add chat message.
  839. * @param {string} from user id
  840. * @param {string} displayName user nickname
  841. * @param {string} message message text
  842. * @param {number} stamp timestamp when message was created
  843. */
  844. UI.addMessage = function (from, displayName, message, stamp) {
  845. Chat.updateChatConversation(from, displayName, message, stamp);
  846. };
  847. UI.updateDTMFSupport
  848. = isDTMFSupported => APP.store.dispatch(showDialPadButton(isDTMFSupported));
  849. /**
  850. * Show user feedback dialog if its required and enabled after pressing the
  851. * hangup button.
  852. * @returns {Promise} Resolved with value - false if the dialog is enabled and
  853. * resolved with true if the dialog is disabled or the feedback was already
  854. * submitted. Rejected if another dialog is already displayed. This values are
  855. * used to display or not display the thank you dialog from
  856. * conference.maybeRedirectToWelcomePage method.
  857. */
  858. UI.requestFeedbackOnHangup = function () {
  859. if (Feedback.isVisible())
  860. return Promise.reject(UIErrors.FEEDBACK_REQUEST_IN_PROGRESS);
  861. // Feedback has been submitted already.
  862. else if (Feedback.isEnabled() && Feedback.isSubmitted()) {
  863. return Promise.resolve({
  864. thankYouDialogVisible : true,
  865. feedbackSubmitted: true
  866. });
  867. }
  868. else
  869. return new Promise(function (resolve) {
  870. if (Feedback.isEnabled()) {
  871. Feedback.openFeedbackWindow(
  872. (options) => {
  873. options.thankYouDialogVisible = false;
  874. resolve(options);
  875. });
  876. } else {
  877. // If the feedback functionality isn't enabled we show a thank
  878. // you dialog. Signaling it (true), so the caller
  879. // of requestFeedback can act on it
  880. resolve(
  881. {thankYouDialogVisible : true, feedbackSubmitted: false});
  882. }
  883. });
  884. };
  885. UI.updateRecordingState = function (state) {
  886. Recording.updateRecordingState(state);
  887. };
  888. UI.notifyTokenAuthFailed = function () {
  889. messageHandler.showError( "dialog.tokenAuthFailedTitle",
  890. "dialog.tokenAuthFailed");
  891. };
  892. UI.notifyInternalError = function () {
  893. messageHandler.showError( "dialog.internalErrorTitle",
  894. "dialog.internalError");
  895. };
  896. UI.notifyFocusDisconnected = function (focus, retrySec) {
  897. messageHandler.notify(
  898. null, "notify.focus",
  899. 'disconnected', "notify.focusFail",
  900. {component: focus, ms: retrySec}
  901. );
  902. };
  903. /**
  904. * Updates auth info on the UI.
  905. * @param {boolean} isAuthEnabled if authentication is enabled
  906. * @param {string} [login] current login
  907. */
  908. UI.updateAuthInfo = function (isAuthEnabled, login) {
  909. let showAuth = isAuthEnabled && UIUtil.isAuthenticationEnabled();
  910. let loggedIn = !!login;
  911. Profile.showAuthenticationButtons(showAuth);
  912. if (showAuth) {
  913. Profile.setAuthenticatedIdentity(login);
  914. Profile.showLoginButton(!loggedIn);
  915. Profile.showLogoutButton(loggedIn);
  916. }
  917. };
  918. UI.onStartMutedChanged = function (startAudioMuted, startVideoMuted) {
  919. SettingsMenu.updateStartMutedBox(startAudioMuted, startVideoMuted);
  920. };
  921. /**
  922. * Notifies interested listeners that the raise hand property has changed.
  923. *
  924. * @param {boolean} isRaisedHand indicates the current state of the
  925. * "raised hand"
  926. */
  927. UI.onLocalRaiseHandChanged = function (isRaisedHand) {
  928. eventEmitter.emit(UIEvents.LOCAL_RAISE_HAND_CHANGED, isRaisedHand);
  929. };
  930. /**
  931. * Update list of available physical devices.
  932. * @param {object[]} devices new list of available devices
  933. */
  934. UI.onAvailableDevicesChanged = function (devices) {
  935. APP.store.dispatch(updateDeviceList(devices));
  936. };
  937. /**
  938. * Returns the id of the current video shown on large.
  939. * Currently used by tests (torture).
  940. */
  941. UI.getLargeVideoID = function () {
  942. return VideoLayout.getLargeVideoID();
  943. };
  944. /**
  945. * Returns the current video shown on large.
  946. * Currently used by tests (torture).
  947. */
  948. UI.getLargeVideo = function () {
  949. return VideoLayout.getLargeVideo();
  950. };
  951. /**
  952. * Shows dialog with a link to FF extension.
  953. */
  954. UI.showExtensionRequiredDialog = function (url) {
  955. messageHandler.openMessageDialog(
  956. "dialog.extensionRequired",
  957. "[html]dialog.firefoxExtensionPrompt",
  958. {url: url});
  959. };
  960. /**
  961. * Shows "Please go to chrome webstore to install the desktop sharing extension"
  962. * 2 button dialog with buttons - cancel and go to web store.
  963. * @param url {string} the url of the extension.
  964. */
  965. UI.showExtensionExternalInstallationDialog = function (url) {
  966. let submitFunction = function(e,v){
  967. if (v) {
  968. e.preventDefault();
  969. eventEmitter.emit(UIEvents.OPEN_EXTENSION_STORE, url);
  970. }
  971. };
  972. let closeFunction = function () {
  973. eventEmitter.emit(UIEvents.EXTERNAL_INSTALLATION_CANCELED);
  974. };
  975. messageHandler.openTwoButtonDialog({
  976. titleKey: 'dialog.externalInstallationTitle',
  977. msgKey: 'dialog.externalInstallationMsg',
  978. leftButtonKey: 'dialog.goToStore',
  979. submitFunction,
  980. loadedFunction: $.noop,
  981. closeFunction
  982. });
  983. };
  984. /**
  985. * Shows dialog with combined information about camera and microphone errors.
  986. * @param {JitsiTrackError} micError
  987. * @param {JitsiTrackError} cameraError
  988. */
  989. UI.showDeviceErrorDialog = function (micError, cameraError) {
  990. let dontShowAgain = {
  991. id: "doNotShowWarningAgain",
  992. localStorageKey: "doNotShowErrorAgain",
  993. textKey: "dialog.doNotShowWarningAgain"
  994. };
  995. let isMicJitsiTrackErrorAndHasName = micError && micError.name &&
  996. micError instanceof JitsiMeetJS.errorTypes.JitsiTrackError;
  997. let isCameraJitsiTrackErrorAndHasName = cameraError && cameraError.name &&
  998. cameraError instanceof JitsiMeetJS.errorTypes.JitsiTrackError;
  999. let showDoNotShowWarning = false;
  1000. if (micError && cameraError && isMicJitsiTrackErrorAndHasName &&
  1001. isCameraJitsiTrackErrorAndHasName) {
  1002. showDoNotShowWarning = true;
  1003. } else if (micError && isMicJitsiTrackErrorAndHasName && !cameraError) {
  1004. showDoNotShowWarning = true;
  1005. } else if (cameraError && isCameraJitsiTrackErrorAndHasName && !micError) {
  1006. showDoNotShowWarning = true;
  1007. }
  1008. if (micError) {
  1009. dontShowAgain.localStorageKey += "-mic-" + micError.name;
  1010. }
  1011. if (cameraError) {
  1012. dontShowAgain.localStorageKey += "-camera-" + cameraError.name;
  1013. }
  1014. let cameraJitsiTrackErrorMsg = cameraError
  1015. ? JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[cameraError.name]
  1016. : undefined;
  1017. let micJitsiTrackErrorMsg = micError
  1018. ? JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[micError.name]
  1019. : undefined;
  1020. let cameraErrorMsg = cameraError
  1021. ? cameraJitsiTrackErrorMsg ||
  1022. JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.GENERAL]
  1023. : "";
  1024. let micErrorMsg = micError
  1025. ? micJitsiTrackErrorMsg ||
  1026. JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.GENERAL]
  1027. : "";
  1028. let additionalCameraErrorMsg = !cameraJitsiTrackErrorMsg && cameraError &&
  1029. cameraError.message
  1030. ? `<div>${cameraError.message}</div>`
  1031. : ``;
  1032. let additionalMicErrorMsg = !micJitsiTrackErrorMsg && micError &&
  1033. micError.message
  1034. ? `<div>${micError.message}</div>`
  1035. : ``;
  1036. let message = '';
  1037. if (micError) {
  1038. message = `
  1039. ${message}
  1040. <h3 data-i18n='dialog.micErrorPresent'></h3>
  1041. <h4 data-i18n='${micErrorMsg}'></h4>
  1042. ${additionalMicErrorMsg}`;
  1043. }
  1044. if (cameraError) {
  1045. message = `
  1046. ${message}
  1047. <h3 data-i18n='dialog.cameraErrorPresent'></h3>
  1048. <h4 data-i18n='${cameraErrorMsg}'></h4>
  1049. ${additionalCameraErrorMsg}`;
  1050. }
  1051. // To make sure we don't have multiple error dialogs open at the same time,
  1052. // we will just close the previous one if we are going to show a new one.
  1053. deviceErrorDialog && deviceErrorDialog.close();
  1054. deviceErrorDialog = messageHandler.openDialog(
  1055. getTitleKey(),
  1056. message,
  1057. false,
  1058. {Ok: true},
  1059. function () {},
  1060. null,
  1061. function () {
  1062. // Reset dialog reference to null to avoid memory leaks when
  1063. // user closed the dialog manually.
  1064. deviceErrorDialog = null;
  1065. },
  1066. showDoNotShowWarning ? dontShowAgain : undefined
  1067. );
  1068. function getTitleKey() {
  1069. let title = "dialog.error";
  1070. if (micError && micError.name === TrackErrors.PERMISSION_DENIED) {
  1071. if (!cameraError
  1072. || cameraError.name === TrackErrors.PERMISSION_DENIED) {
  1073. title = "dialog.permissionDenied";
  1074. }
  1075. } else if (cameraError
  1076. && cameraError.name === TrackErrors.PERMISSION_DENIED) {
  1077. title = "dialog.permissionDenied";
  1078. }
  1079. return title;
  1080. }
  1081. };
  1082. /**
  1083. * Shows error dialog that informs the user that no data is received from the
  1084. * device.
  1085. */
  1086. UI.showTrackNotWorkingDialog = function (stream) {
  1087. messageHandler.openMessageDialog(
  1088. "dialog.error",
  1089. stream.isAudioTrack()? "dialog.micNotSendingData" :
  1090. "dialog.cameraNotSendingData");
  1091. };
  1092. UI.updateDevicesAvailability = function (id, devices) {
  1093. VideoLayout.setDeviceAvailabilityIcons(id, devices);
  1094. };
  1095. /**
  1096. * Show shared video.
  1097. * @param {string} id the id of the sender of the command
  1098. * @param {string} url video url
  1099. * @param {string} attributes
  1100. */
  1101. UI.onSharedVideoStart = function (id, url, attributes) {
  1102. if (sharedVideoManager)
  1103. sharedVideoManager.onSharedVideoStart(id, url, attributes);
  1104. };
  1105. /**
  1106. * Update shared video.
  1107. * @param {string} id the id of the sender of the command
  1108. * @param {string} url video url
  1109. * @param {string} attributes
  1110. */
  1111. UI.onSharedVideoUpdate = function (id, url, attributes) {
  1112. if (sharedVideoManager)
  1113. sharedVideoManager.onSharedVideoUpdate(id, url, attributes);
  1114. };
  1115. /**
  1116. * Stop showing shared video.
  1117. * @param {string} id the id of the sender of the command
  1118. * @param {string} attributes
  1119. */
  1120. UI.onSharedVideoStop = function (id, attributes) {
  1121. if (sharedVideoManager)
  1122. sharedVideoManager.onSharedVideoStop(id, attributes);
  1123. };
  1124. /**
  1125. * Enables / disables camera toolbar button.
  1126. *
  1127. * @param {boolean} enabled indicates if the camera button should be enabled
  1128. * or disabled
  1129. */
  1130. UI.setCameraButtonEnabled
  1131. = enabled => APP.store.dispatch(setVideoIconEnabled(enabled));
  1132. /**
  1133. * Enables / disables microphone toolbar button.
  1134. *
  1135. * @param {boolean} enabled indicates if the microphone button should be
  1136. * enabled or disabled
  1137. */
  1138. UI.setMicrophoneButtonEnabled
  1139. = enabled => APP.store.dispatch(setAudioIconEnabled(enabled));
  1140. UI.showRingOverlay = function () {
  1141. RingOverlay.show(APP.tokenData.callee, interfaceConfig.DISABLE_RINGING);
  1142. FilmStrip.toggleFilmStrip(false, false);
  1143. };
  1144. UI.hideRingOverLay = function () {
  1145. if (!RingOverlay.hide())
  1146. return;
  1147. FilmStrip.toggleFilmStrip(true, false);
  1148. };
  1149. /**
  1150. * Indicates if any the "top" overlays are currently visible. The check includes
  1151. * the call overlay, suspended overlay, GUM permissions overlay
  1152. * and a page reload overlay.
  1153. *
  1154. * @returns {*|boolean} {true} if the overlay is visible, {false} otherwise
  1155. */
  1156. UI.isOverlayVisible = function () {
  1157. return RingOverlay.isVisible() || this.overlayVisible;
  1158. };
  1159. /**
  1160. * Indicates if the ring overlay is currently visible.
  1161. *
  1162. * @returns {*|boolean} {true} if the ring overlay is visible, {false} otherwise
  1163. */
  1164. UI.isRingOverlayVisible = () => RingOverlay.isVisible();
  1165. /**
  1166. * Handles user's features changes.
  1167. */
  1168. UI.onUserFeaturesChanged = user => VideoLayout.onUserFeaturesChanged(user);
  1169. const UIListeners = new Map([
  1170. [
  1171. UIEvents.ETHERPAD_CLICKED,
  1172. () => etherpadManager && etherpadManager.toggleEtherpad()
  1173. ], [
  1174. UIEvents.SHARED_VIDEO_CLICKED,
  1175. () => sharedVideoManager && sharedVideoManager.toggleSharedVideo()
  1176. ], [
  1177. UIEvents.TOGGLE_FULLSCREEN,
  1178. UI.toggleFullScreen
  1179. ], [
  1180. UIEvents.TOGGLE_CHAT,
  1181. UI.toggleChat
  1182. ], [
  1183. UIEvents.TOGGLE_SETTINGS,
  1184. () => UI.toggleSidePanel("settings_container")
  1185. ], [
  1186. UIEvents.TOGGLE_CONTACT_LIST,
  1187. UI.toggleContactList
  1188. ], [
  1189. UIEvents.TOGGLE_PROFILE,
  1190. () => APP.tokenData.isGuest && UI.toggleSidePanel("profile_container")
  1191. ], [
  1192. UIEvents.TOGGLE_FILM_STRIP,
  1193. UI.handleToggleFilmStrip
  1194. ], [
  1195. UIEvents.FOLLOW_ME_ENABLED,
  1196. enabled => (followMeHandler && followMeHandler.enableFollowMe(enabled))
  1197. ]
  1198. ]);
  1199. module.exports = UI;