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

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