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.

UI.js 39KB

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