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

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