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.

Toolbox.js 46KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459
  1. // @flow
  2. import React, { Component } from 'react';
  3. import keyboardShortcut from '../../../../../modules/keyboardshortcut/keyboardshortcut';
  4. import {
  5. ACTION_SHORTCUT_TRIGGERED,
  6. createShortcutEvent,
  7. createToolbarEvent,
  8. sendAnalytics
  9. } from '../../../analytics';
  10. import { getToolbarButtons } from '../../../base/config';
  11. import { isToolbarButtonEnabled } from '../../../base/config/functions.web';
  12. import { openDialog, toggleDialog } from '../../../base/dialog';
  13. import { isMobileBrowser } from '../../../base/environment/utils';
  14. import { translate } from '../../../base/i18n';
  15. import {
  16. IconChat,
  17. IconCodeBlock,
  18. IconDeviceDocument,
  19. IconExitFullScreen,
  20. IconFeedback,
  21. IconFullScreen,
  22. IconParticipants,
  23. IconPresentation,
  24. IconRaisedHand,
  25. IconRec,
  26. IconShareAudio,
  27. IconShareDesktop
  28. } from '../../../base/icons';
  29. import JitsiMeetJS from '../../../base/lib-jitsi-meet';
  30. import {
  31. getLocalParticipant,
  32. getParticipants,
  33. participantUpdated
  34. } from '../../../base/participants';
  35. import { connect } from '../../../base/redux';
  36. import { OverflowMenuItem } from '../../../base/toolbox/components';
  37. import { getLocalVideoTrack, toggleScreensharing } from '../../../base/tracks';
  38. import { isVpaasMeeting } from '../../../billing-counter/functions';
  39. import { ChatCounter, toggleChat } from '../../../chat';
  40. import { EmbedMeetingDialog } from '../../../embed-meeting';
  41. import { SharedDocumentButton } from '../../../etherpad';
  42. import { openFeedbackDialog } from '../../../feedback';
  43. import { openKeyboardShortcutsDialog } from '../../../keyboard-shortcuts';
  44. import { LocalRecordingInfoDialog } from '../../../local-recording';
  45. import {
  46. close as closeParticipantsPane,
  47. open as openParticipantsPane
  48. } from '../../../participants-pane/actions';
  49. import { getParticipantsPaneOpen } from '../../../participants-pane/functions';
  50. import {
  51. LiveStreamButton,
  52. RecordButton
  53. } from '../../../recording';
  54. import { isScreenAudioShared, isScreenAudioSupported } from '../../../screen-share/';
  55. import SecurityDialogButton from '../../../security/components/security-dialog/SecurityDialogButton';
  56. import {
  57. SETTINGS_TABS,
  58. SettingsButton,
  59. openSettingsDialog
  60. } from '../../../settings';
  61. import { SharedVideoButton } from '../../../shared-video/components';
  62. import { SpeakerStats } from '../../../speaker-stats';
  63. import {
  64. ClosedCaptionButton
  65. } from '../../../subtitles';
  66. import {
  67. TileViewButton,
  68. shouldDisplayTileView,
  69. toggleTileView
  70. } from '../../../video-layout';
  71. import {
  72. OverflowMenuVideoQualityItem,
  73. VideoQualityDialog
  74. } from '../../../video-quality';
  75. import { VideoBackgroundButton } from '../../../virtual-background';
  76. import { toggleBackgroundEffect } from '../../../virtual-background/actions';
  77. import { VIRTUAL_BACKGROUND_TYPE } from '../../../virtual-background/constants';
  78. import { checkBlurSupport } from '../../../virtual-background/functions';
  79. import {
  80. setFullScreen,
  81. setOverflowMenuVisible,
  82. setToolbarHovered,
  83. showToolbox
  84. } from '../../actions';
  85. import { getToolbarAdditionalButtons, isToolboxVisible } from '../../functions';
  86. import DownloadButton from '../DownloadButton';
  87. import HangupButton from '../HangupButton';
  88. import HelpButton from '../HelpButton';
  89. import MuteEveryoneButton from '../MuteEveryoneButton';
  90. import MuteEveryonesVideoButton from '../MuteEveryonesVideoButton';
  91. import AudioSettingsButton from './AudioSettingsButton';
  92. import OverflowMenuButton from './OverflowMenuButton';
  93. import OverflowMenuProfileItem from './OverflowMenuProfileItem';
  94. import ToggleCameraButton from './ToggleCameraButton';
  95. import ToolbarButton from './ToolbarButton';
  96. import VideoSettingsButton from './VideoSettingsButton';
  97. /**
  98. * The type of the React {@code Component} props of {@link Toolbox}.
  99. */
  100. type Props = {
  101. /**
  102. * String showing if the virtual background type is desktop-share.
  103. */
  104. _backgroundType: String,
  105. /**
  106. * Whether or not the chat feature is currently displayed.
  107. */
  108. _chatOpen: boolean,
  109. /**
  110. * The width of the client.
  111. */
  112. _clientWidth: number,
  113. /**
  114. * The {@code JitsiConference} for the current conference.
  115. */
  116. _conference: Object,
  117. /**
  118. * The tooltip key to use when screensharing is disabled. Or undefined
  119. * if non to be shown and the button to be hidden.
  120. */
  121. _desktopSharingDisabledTooltipKey: boolean,
  122. /**
  123. * Whether or not screensharing is initialized.
  124. */
  125. _desktopSharingEnabled: boolean,
  126. /**
  127. * Whether or not a dialog is displayed.
  128. */
  129. _dialog: boolean,
  130. /**
  131. * Whether or not call feedback can be sent.
  132. */
  133. _feedbackConfigured: boolean,
  134. /**
  135. * Whether or not the app is currently in full screen.
  136. */
  137. _fullScreen: boolean,
  138. /**
  139. * Whether or not the app is running in mobile browser.
  140. */
  141. _isMobile: boolean,
  142. /**
  143. * Whether or not the profile is disabled.
  144. */
  145. _isProfileDisabled: boolean,
  146. /**
  147. * Whether or not the tile view is enabled.
  148. */
  149. _tileViewEnabled: boolean,
  150. /**
  151. * Whether or not the current meeting belongs to a JaaS user.
  152. */
  153. _isVpaasMeeting: boolean,
  154. /**
  155. * The ID of the local participant.
  156. */
  157. _localParticipantID: String,
  158. /**
  159. * The subsection of Redux state for local recording
  160. */
  161. _localRecState: Object,
  162. /**
  163. * The value for how the conference is locked (or undefined if not locked)
  164. * as defined by room-lock constants.
  165. */
  166. _locked: boolean,
  167. /**
  168. * The JitsiLocalTrack to display.
  169. */
  170. _localVideo: Object,
  171. /**
  172. * Whether or not the overflow menu is visible.
  173. */
  174. _overflowMenuVisible: boolean,
  175. /**
  176. * Whether or not the participants pane is open.
  177. */
  178. _participantsPaneOpen: boolean,
  179. /**
  180. * Whether or not the local participant's hand is raised.
  181. */
  182. _raisedHand: boolean,
  183. /**
  184. * Whether or not the local participant is screensharing.
  185. */
  186. _screensharing: boolean,
  187. /**
  188. * Whether or not the local participant is sharing a YouTube video.
  189. */
  190. _sharingVideo: boolean,
  191. /**
  192. * Flag showing whether toolbar is visible.
  193. */
  194. _visible: boolean,
  195. /**
  196. * Array with the buttons which this Toolbox should display.
  197. */
  198. _visibleButtons: Array<string>,
  199. /**
  200. * Handler to check if a button is enabled.
  201. */
  202. _shouldShowButton: Function,
  203. /**
  204. * Returns the selected virtual source object.
  205. */
  206. _virtualSource: Object,
  207. /**
  208. * Invoked to active other features of the app.
  209. */
  210. dispatch: Function,
  211. /**
  212. * Invoked to obtain translated strings.
  213. */
  214. t: Function
  215. };
  216. declare var APP: Object;
  217. /**
  218. * Implements the conference toolbox on React/Web.
  219. *
  220. * @extends Component
  221. */
  222. class Toolbox extends Component<Props> {
  223. /**
  224. * Initializes a new {@code Toolbox} instance.
  225. *
  226. * @param {Props} props - The read-only React {@code Component} props with
  227. * which the new instance is to be initialized.
  228. */
  229. constructor(props: Props) {
  230. super(props);
  231. // Bind event handlers so they are only bound once per instance.
  232. this._onMouseOut = this._onMouseOut.bind(this);
  233. this._onMouseOver = this._onMouseOver.bind(this);
  234. this._onSetOverflowVisible = this._onSetOverflowVisible.bind(this);
  235. this._onTabIn = this._onTabIn.bind(this);
  236. this._onShortcutToggleChat = this._onShortcutToggleChat.bind(this);
  237. this._onShortcutToggleFullScreen = this._onShortcutToggleFullScreen.bind(this);
  238. this._onShortcutToggleParticipantsPane = this._onShortcutToggleParticipantsPane.bind(this);
  239. this._onShortcutToggleRaiseHand = this._onShortcutToggleRaiseHand.bind(this);
  240. this._onShortcutToggleScreenshare = this._onShortcutToggleScreenshare.bind(this);
  241. this._onShortcutToggleVideoQuality = this._onShortcutToggleVideoQuality.bind(this);
  242. this._onToolbarOpenFeedback = this._onToolbarOpenFeedback.bind(this);
  243. this._onToolbarToggleParticipantsPane = this._onToolbarToggleParticipantsPane.bind(this);
  244. this._onToolbarOpenKeyboardShortcuts = this._onToolbarOpenKeyboardShortcuts.bind(this);
  245. this._onToolbarOpenSpeakerStats = this._onToolbarOpenSpeakerStats.bind(this);
  246. this._onToolbarOpenEmbedMeeting = this._onToolbarOpenEmbedMeeting.bind(this);
  247. this._onToolbarOpenVideoQuality = this._onToolbarOpenVideoQuality.bind(this);
  248. this._onToolbarToggleChat = this._onToolbarToggleChat.bind(this);
  249. this._onToolbarToggleFullScreen = this._onToolbarToggleFullScreen.bind(this);
  250. this._onToolbarToggleProfile = this._onToolbarToggleProfile.bind(this);
  251. this._onToolbarToggleRaiseHand = this._onToolbarToggleRaiseHand.bind(this);
  252. this._onToolbarToggleScreenshare = this._onToolbarToggleScreenshare.bind(this);
  253. this._onToolbarToggleShareAudio = this._onToolbarToggleShareAudio.bind(this);
  254. this._onToolbarOpenLocalRecordingInfoDialog = this._onToolbarOpenLocalRecordingInfoDialog.bind(this);
  255. this._onShortcutToggleTileView = this._onShortcutToggleTileView.bind(this);
  256. this._onEscKey = this._onEscKey.bind(this);
  257. }
  258. /**
  259. * Sets keyboard shortcuts for to trigger ToolbarButtons actions.
  260. *
  261. * @inheritdoc
  262. * @returns {void}
  263. */
  264. componentDidMount() {
  265. const KEYBOARD_SHORTCUTS = [
  266. this.props._shouldShowButton('videoquality') && {
  267. character: 'A',
  268. exec: this._onShortcutToggleVideoQuality,
  269. helpDescription: 'toolbar.callQuality'
  270. },
  271. this.props._shouldShowButton('chat') && {
  272. character: 'C',
  273. exec: this._onShortcutToggleChat,
  274. helpDescription: 'keyboardShortcuts.toggleChat'
  275. },
  276. this.props._shouldShowButton('desktop') && {
  277. character: 'D',
  278. exec: this._onShortcutToggleScreenshare,
  279. helpDescription: 'keyboardShortcuts.toggleScreensharing'
  280. },
  281. this.props._shouldShowButton('participants-pane') && {
  282. character: 'P',
  283. exec: this._onShortcutToggleParticipantsPane,
  284. helpDescription: 'keyboardShortcuts.toggleParticipantsPane'
  285. },
  286. this.props._shouldShowButton('raisehand') && {
  287. character: 'R',
  288. exec: this._onShortcutToggleRaiseHand,
  289. helpDescription: 'keyboardShortcuts.raiseHand'
  290. },
  291. this.props._shouldShowButton('fullscreen') && {
  292. character: 'S',
  293. exec: this._onShortcutToggleFullScreen,
  294. helpDescription: 'keyboardShortcuts.fullScreen'
  295. },
  296. this.props._shouldShowButton('tileview') && {
  297. character: 'W',
  298. exec: this._onShortcutToggleTileView,
  299. helpDescription: 'toolbar.tileViewToggle'
  300. }
  301. ];
  302. KEYBOARD_SHORTCUTS.forEach(shortcut => {
  303. if (typeof shortcut === 'object') {
  304. APP.keyboardshortcut.registerShortcut(
  305. shortcut.character,
  306. null,
  307. shortcut.exec,
  308. shortcut.helpDescription);
  309. }
  310. });
  311. }
  312. /**
  313. * Update the visibility of the {@code OverflowMenuButton}.
  314. *
  315. * @inheritdoc
  316. */
  317. componentDidUpdate(prevProps) {
  318. // Ensure the dialog is closed when the toolbox becomes hidden.
  319. if (prevProps._overflowMenuVisible && !this.props._visible) {
  320. this._onSetOverflowVisible(false);
  321. }
  322. if (prevProps._overflowMenuVisible
  323. && !prevProps._dialog
  324. && this.props._dialog) {
  325. this._onSetOverflowVisible(false);
  326. this.props.dispatch(setToolbarHovered(false));
  327. }
  328. }
  329. /**
  330. * Removes keyboard shortcuts registered by this component.
  331. *
  332. * @inheritdoc
  333. * @returns {void}
  334. */
  335. componentWillUnmount() {
  336. [ 'A', 'C', 'D', 'R', 'S' ].forEach(letter =>
  337. APP.keyboardshortcut.unregisterShortcut(letter));
  338. }
  339. /**
  340. * Implements React's {@link Component#render()}.
  341. *
  342. * @inheritdoc
  343. * @returns {ReactElement}
  344. */
  345. render() {
  346. const { _chatOpen, _visible, _visibleButtons } = this.props;
  347. const rootClassNames = `new-toolbox ${_visible ? 'visible' : ''} ${
  348. _visibleButtons.length ? '' : 'no-buttons'} ${_chatOpen ? 'shift-right' : ''}`;
  349. return (
  350. <div
  351. className = { rootClassNames }
  352. id = 'new-toolbox'>
  353. { this._renderToolboxContent() }
  354. </div>
  355. );
  356. }
  357. _onEscKey: (KeyboardEvent) => void;
  358. /**
  359. * Key handler for overflow menu.
  360. *
  361. * @param {KeyboardEvent} e - Esc key click to close the popup.
  362. * @returns {void}
  363. */
  364. _onEscKey(e) {
  365. if (e.key === 'Escape') {
  366. e.stopPropagation();
  367. this._closeOverflowMenuIfOpen();
  368. }
  369. }
  370. /**
  371. * Closes the overflow menu if opened.
  372. *
  373. * @private
  374. * @returns {void}
  375. */
  376. _closeOverflowMenuIfOpen() {
  377. const { dispatch, _overflowMenuVisible } = this.props;
  378. _overflowMenuVisible && dispatch(setOverflowMenuVisible(false));
  379. }
  380. /**
  381. * Callback invoked to display {@code FeedbackDialog}.
  382. *
  383. * @private
  384. * @returns {void}
  385. */
  386. _doOpenFeedback() {
  387. const { _conference } = this.props;
  388. this.props.dispatch(openFeedbackDialog(_conference));
  389. }
  390. /**
  391. * Callback invoked to display {@code FeedbackDialog}.
  392. *
  393. * @private
  394. * @returns {void}
  395. */
  396. _doOpenEmbedMeeting() {
  397. this.props.dispatch(openDialog(EmbedMeetingDialog));
  398. }
  399. /**
  400. * Dispatches an action to display {@code KeyboardShortcuts}.
  401. *
  402. * @private
  403. * @returns {void}
  404. */
  405. _doOpenKeyboardShorcuts() {
  406. this.props.dispatch(openKeyboardShortcutsDialog());
  407. }
  408. /**
  409. * Callback invoked to display {@code SpeakerStats}.
  410. *
  411. * @private
  412. * @returns {void}
  413. */
  414. _doOpenSpeakerStats() {
  415. this.props.dispatch(openDialog(SpeakerStats, {
  416. conference: this.props._conference
  417. }));
  418. }
  419. /**
  420. * Dispatches an action to open the video quality dialog.
  421. *
  422. * @private
  423. * @returns {void}
  424. */
  425. _doOpenVideoQuality() {
  426. this.props.dispatch(openDialog(VideoQualityDialog));
  427. }
  428. /**
  429. * Dispatches an action to toggle the display of chat.
  430. *
  431. * @private
  432. * @returns {void}
  433. */
  434. _doToggleChat() {
  435. this.props.dispatch(toggleChat());
  436. }
  437. /**
  438. * Dispatches an action to toggle screensharing.
  439. *
  440. * @private
  441. * @returns {void}
  442. */
  443. _doToggleFullScreen() {
  444. const fullScreen = !this.props._fullScreen;
  445. this.props.dispatch(setFullScreen(fullScreen));
  446. }
  447. /**
  448. * Dispatches an action to show or hide the profile edit panel.
  449. *
  450. * @private
  451. * @returns {void}
  452. */
  453. _doToggleProfile() {
  454. this.props.dispatch(openSettingsDialog(SETTINGS_TABS.PROFILE));
  455. }
  456. /**
  457. * Dispatches an action to toggle the local participant's raised hand state.
  458. *
  459. * @private
  460. * @returns {void}
  461. */
  462. _doToggleRaiseHand() {
  463. const { _localParticipantID, _raisedHand } = this.props;
  464. const newRaisedStatus = !_raisedHand;
  465. this.props.dispatch(participantUpdated({
  466. // XXX Only the local participant is allowed to update without
  467. // stating the JitsiConference instance (i.e. participant property
  468. // `conference` for a remote participant) because the local
  469. // participant is uniquely identified by the very fact that there is
  470. // only one local participant.
  471. id: _localParticipantID,
  472. local: true,
  473. raisedHand: newRaisedStatus
  474. }));
  475. APP.API.notifyRaiseHandUpdated(_localParticipantID, newRaisedStatus);
  476. }
  477. /**
  478. * Dispatches an action to toggle screensharing.
  479. *
  480. * @private
  481. * @param {boolean} enabled - The state to toggle screen sharing to.
  482. * @param {boolean} audioOnly - Only share system audio.
  483. * @returns {void}
  484. */
  485. _doToggleScreenshare(enabled, audioOnly = false) {
  486. if (this.props._desktopSharingEnabled) {
  487. this.props.dispatch(toggleScreensharing(enabled, audioOnly));
  488. }
  489. }
  490. /**
  491. * Dispatches an action to toggle the video quality dialog.
  492. *
  493. * @private
  494. * @returns {void}
  495. */
  496. _doToggleVideoQuality() {
  497. this.props.dispatch(toggleDialog(VideoQualityDialog));
  498. }
  499. /**
  500. * Dispaches an action to toggle tile view.
  501. *
  502. * @private
  503. * @returns {void}
  504. */
  505. _doToggleTileView() {
  506. this.props.dispatch(toggleTileView());
  507. }
  508. _onMouseOut: () => void;
  509. /**
  510. * Dispatches an action signaling the toolbar is not being hovered.
  511. *
  512. * @private
  513. * @returns {void}
  514. */
  515. _onMouseOut() {
  516. this.props.dispatch(setToolbarHovered(false));
  517. }
  518. _onMouseOver: () => void;
  519. /**
  520. * Dispatches an action signaling the toolbar is being hovered.
  521. *
  522. * @private
  523. * @returns {void}
  524. */
  525. _onMouseOver() {
  526. this.props.dispatch(setToolbarHovered(true));
  527. }
  528. _onSetOverflowVisible: (boolean) => void;
  529. /**
  530. * Sets the visibility of the overflow menu.
  531. *
  532. * @param {boolean} visible - Whether or not the overflow menu should be
  533. * displayed.
  534. * @private
  535. * @returns {void}
  536. */
  537. _onSetOverflowVisible(visible) {
  538. this.props.dispatch(setOverflowMenuVisible(visible));
  539. }
  540. _onShortcutToggleChat: () => void;
  541. /**
  542. * Creates an analytics keyboard shortcut event and dispatches an action for
  543. * toggling the display of chat.
  544. *
  545. * @private
  546. * @returns {void}
  547. */
  548. _onShortcutToggleChat() {
  549. sendAnalytics(createShortcutEvent(
  550. 'toggle.chat',
  551. {
  552. enable: !this.props._chatOpen
  553. }));
  554. // Checks if there was any text selected by the user.
  555. // Used for when we press simultaneously keys for copying
  556. // text messages from the chat board
  557. if (window.getSelection().toString() !== '') {
  558. return false;
  559. }
  560. this._doToggleChat();
  561. }
  562. _onShortcutToggleParticipantsPane: () => void;
  563. /**
  564. * Creates an analytics keyboard shortcut event and dispatches an action for
  565. * toggling the display of the participants pane.
  566. *
  567. * @private
  568. * @returns {void}
  569. */
  570. _onShortcutToggleParticipantsPane() {
  571. sendAnalytics(createShortcutEvent(
  572. 'toggle.participants-pane',
  573. {
  574. enable: !this.props._participantsPaneOpen
  575. }));
  576. this._onToolbarToggleParticipantsPane();
  577. }
  578. _onShortcutToggleVideoQuality: () => void;
  579. /**
  580. * Creates an analytics keyboard shortcut event and dispatches an action for
  581. * toggling the display of Video Quality.
  582. *
  583. * @private
  584. * @returns {void}
  585. */
  586. _onShortcutToggleVideoQuality() {
  587. sendAnalytics(createShortcutEvent('video.quality'));
  588. this._doToggleVideoQuality();
  589. }
  590. _onShortcutToggleTileView: () => void;
  591. /**
  592. * Dispatches an action for toggling the tile view.
  593. *
  594. * @private
  595. * @returns {void}
  596. */
  597. _onShortcutToggleTileView() {
  598. sendAnalytics(createShortcutEvent(
  599. 'toggle.tileview',
  600. {
  601. enable: !this.props._tileViewEnabled
  602. }));
  603. this._doToggleTileView();
  604. }
  605. _onShortcutToggleFullScreen: () => void;
  606. /**
  607. * Creates an analytics keyboard shortcut event and dispatches an action for
  608. * toggling full screen mode.
  609. *
  610. * @private
  611. * @returns {void}
  612. */
  613. _onShortcutToggleFullScreen() {
  614. sendAnalytics(createShortcutEvent(
  615. 'toggle.fullscreen',
  616. {
  617. enable: !this.props._fullScreen
  618. }));
  619. this._doToggleFullScreen();
  620. }
  621. _onShortcutToggleRaiseHand: () => void;
  622. /**
  623. * Creates an analytics keyboard shortcut event and dispatches an action for
  624. * toggling raise hand.
  625. *
  626. * @private
  627. * @returns {void}
  628. */
  629. _onShortcutToggleRaiseHand() {
  630. sendAnalytics(createShortcutEvent(
  631. 'toggle.raise.hand',
  632. ACTION_SHORTCUT_TRIGGERED,
  633. { enable: !this.props._raisedHand }));
  634. this._doToggleRaiseHand();
  635. }
  636. _onShortcutToggleScreenshare: () => void;
  637. /**
  638. * Creates an analytics keyboard shortcut event and dispatches an action for
  639. * toggling screensharing.
  640. *
  641. * @private
  642. * @returns {void}
  643. */
  644. _onShortcutToggleScreenshare() {
  645. const enable = !this.props._screensharing;
  646. sendAnalytics(createToolbarEvent(
  647. 'screen.sharing',
  648. {
  649. enable
  650. }));
  651. this._doToggleScreenshare(enable);
  652. }
  653. _onTabIn: () => void;
  654. /**
  655. * Toggle the toolbar visibility when tabbing into it.
  656. *
  657. * @returns {void}
  658. */
  659. _onTabIn() {
  660. if (!this.props._visible) {
  661. this.props.dispatch(showToolbox());
  662. }
  663. }
  664. _onToolbarOpenFeedback: () => void;
  665. /**
  666. * Creates an analytics toolbar event and dispatches an action for toggling
  667. * display of feedback.
  668. *
  669. * @private
  670. * @returns {void}
  671. */
  672. _onToolbarOpenFeedback() {
  673. sendAnalytics(createToolbarEvent('feedback'));
  674. this._doOpenFeedback();
  675. }
  676. _onToolbarToggleParticipantsPane: () => void;
  677. /**
  678. * Dispatches an action for toggling the participants pane.
  679. *
  680. * @private
  681. * @returns {void}
  682. */
  683. _onToolbarToggleParticipantsPane() {
  684. const { dispatch, _participantsPaneOpen } = this.props;
  685. if (_participantsPaneOpen) {
  686. dispatch(closeParticipantsPane());
  687. } else {
  688. dispatch(openParticipantsPane());
  689. }
  690. }
  691. _onToolbarOpenKeyboardShortcuts: () => void;
  692. /**
  693. * Creates an analytics toolbar event and dispatches an action for opening
  694. * the modal for showing available keyboard shortcuts.
  695. *
  696. * @private
  697. * @returns {void}
  698. */
  699. _onToolbarOpenKeyboardShortcuts() {
  700. sendAnalytics(createToolbarEvent('shortcuts'));
  701. this._doOpenKeyboardShorcuts();
  702. }
  703. _onToolbarOpenEmbedMeeting: () => void;
  704. /**
  705. * Creates an analytics toolbar event and dispatches an action for opening
  706. * the embed meeting modal.
  707. *
  708. * @private
  709. * @returns {void}
  710. */
  711. _onToolbarOpenEmbedMeeting() {
  712. sendAnalytics(createToolbarEvent('embed.meeting'));
  713. this._doOpenEmbedMeeting();
  714. }
  715. _onToolbarOpenSpeakerStats: () => void;
  716. /**
  717. * Creates an analytics toolbar event and dispatches an action for opening
  718. * the speaker stats modal.
  719. *
  720. * @private
  721. * @returns {void}
  722. */
  723. _onToolbarOpenSpeakerStats() {
  724. sendAnalytics(createToolbarEvent('speaker.stats'));
  725. this._doOpenSpeakerStats();
  726. }
  727. _onToolbarOpenVideoQuality: () => void;
  728. /**
  729. * Creates an analytics toolbar event and dispatches an action for toggling
  730. * open the video quality dialog.
  731. *
  732. * @private
  733. * @returns {void}
  734. */
  735. _onToolbarOpenVideoQuality() {
  736. sendAnalytics(createToolbarEvent('video.quality'));
  737. this._doOpenVideoQuality();
  738. }
  739. _onToolbarToggleChat: () => void;
  740. /**
  741. * Creates an analytics toolbar event and dispatches an action for toggling
  742. * the display of chat.
  743. *
  744. * @private
  745. * @returns {void}
  746. */
  747. _onToolbarToggleChat() {
  748. sendAnalytics(createToolbarEvent(
  749. 'toggle.chat',
  750. {
  751. enable: !this.props._chatOpen
  752. }));
  753. this._closeOverflowMenuIfOpen();
  754. this._doToggleChat();
  755. }
  756. _onToolbarToggleFullScreen: () => void;
  757. /**
  758. * Creates an analytics toolbar event and dispatches an action for toggling
  759. * full screen mode.
  760. *
  761. * @private
  762. * @returns {void}
  763. */
  764. _onToolbarToggleFullScreen() {
  765. sendAnalytics(createToolbarEvent(
  766. 'toggle.fullscreen',
  767. {
  768. enable: !this.props._fullScreen
  769. }));
  770. this._closeOverflowMenuIfOpen();
  771. this._doToggleFullScreen();
  772. }
  773. _onToolbarToggleProfile: () => void;
  774. /**
  775. * Creates an analytics toolbar event and dispatches an action for showing
  776. * or hiding the profile edit panel.
  777. *
  778. * @private
  779. * @returns {void}
  780. */
  781. _onToolbarToggleProfile() {
  782. sendAnalytics(createToolbarEvent('profile'));
  783. this._doToggleProfile();
  784. }
  785. _onToolbarToggleRaiseHand: () => void;
  786. /**
  787. * Creates an analytics toolbar event and dispatches an action for toggling
  788. * raise hand.
  789. *
  790. * @private
  791. * @returns {void}
  792. */
  793. _onToolbarToggleRaiseHand() {
  794. sendAnalytics(createToolbarEvent(
  795. 'raise.hand',
  796. { enable: !this.props._raisedHand }));
  797. this._doToggleRaiseHand();
  798. }
  799. _onToolbarToggleScreenshare: () => void;
  800. /**
  801. * Creates an analytics toolbar event and dispatches an action for toggling
  802. * screensharing.
  803. *
  804. * @private
  805. * @returns {void}
  806. */
  807. _onToolbarToggleScreenshare() {
  808. if (this.props._backgroundType === VIRTUAL_BACKGROUND_TYPE.DESKTOP_SHARE) {
  809. const noneOptions = {
  810. enabled: false,
  811. backgroundType: VIRTUAL_BACKGROUND_TYPE.NONE,
  812. selectedThumbnail: VIRTUAL_BACKGROUND_TYPE.NONE,
  813. backgroundEffectEnabled: false
  814. };
  815. this.props._virtualSource.dispose();
  816. this.props.dispatch(toggleBackgroundEffect(noneOptions, this.props._localVideo));
  817. return;
  818. }
  819. if (!this.props._desktopSharingEnabled) {
  820. return;
  821. }
  822. const enable = !this.props._screensharing;
  823. sendAnalytics(createShortcutEvent(
  824. 'toggle.screen.sharing',
  825. ACTION_SHORTCUT_TRIGGERED,
  826. { enable }));
  827. this._closeOverflowMenuIfOpen();
  828. this._doToggleScreenshare(enable);
  829. }
  830. _onToolbarToggleShareAudio: () => void;
  831. /**
  832. * Handles toggle share audio action.
  833. *
  834. * @returns {void}
  835. */
  836. _onToolbarToggleShareAudio() {
  837. const enable = !this.props._screensharing;
  838. this._closeOverflowMenuIfOpen();
  839. this._doToggleScreenshare(enable, true);
  840. }
  841. _onToolbarOpenLocalRecordingInfoDialog: () => void;
  842. /**
  843. * Opens the {@code LocalRecordingInfoDialog}.
  844. *
  845. * @private
  846. * @returns {void}
  847. */
  848. _onToolbarOpenLocalRecordingInfoDialog() {
  849. sendAnalytics(createToolbarEvent('local.recording'));
  850. this.props.dispatch(openDialog(LocalRecordingInfoDialog));
  851. }
  852. /**
  853. * Returns true if the desktop sharing button should be visible and
  854. * false otherwise.
  855. *
  856. * @returns {boolean}
  857. */
  858. _showDesktopSharingButton() {
  859. const {
  860. _desktopSharingEnabled,
  861. _desktopSharingDisabledTooltipKey
  862. } = this.props;
  863. return (
  864. (_desktopSharingEnabled
  865. || _desktopSharingDisabledTooltipKey)
  866. && this.props._shouldShowButton('desktop')
  867. );
  868. }
  869. /**
  870. * Returns true if the embed meeting button is visible and false otherwise.
  871. *
  872. * @returns {boolean}
  873. */
  874. _isEmbedMeetingVisible() {
  875. return !this.props._isVpaasMeeting
  876. && !this.props._isMobile
  877. && this.props._shouldShowButton('embedmeeting');
  878. }
  879. /**
  880. * Returns true if the profile button is visible and false otherwise.
  881. *
  882. * @returns {boolean}
  883. */
  884. _isProfileVisible() {
  885. return !this.props._isProfileDisabled && this.props._shouldShowButton('profile');
  886. }
  887. /**
  888. * Renders the list elements of the overflow menu.
  889. *
  890. * @private
  891. * @param {Array<React$Element>} additionalButtons - Additional buttons to be displayed.
  892. * @returns {Array<React$Element>}
  893. */
  894. _renderOverflowMenuContent(additionalButtons: Array<React$Element<any>>) {
  895. const {
  896. _desktopSharingEnabled,
  897. _feedbackConfigured,
  898. _fullScreen,
  899. _isMobile,
  900. _screensharing,
  901. t
  902. } = this.props;
  903. const group1 = [
  904. ...additionalButtons,
  905. this.props._shouldShowButton('toggle-camera')
  906. && <ToggleCameraButton
  907. key = 'toggle-camera'
  908. showLabel = { true } />,
  909. this.props._shouldShowButton('videoquality')
  910. && <OverflowMenuVideoQualityItem
  911. key = 'videoquality'
  912. onClick = { this._onToolbarOpenVideoQuality } />,
  913. this.props._shouldShowButton('fullscreen')
  914. && !_isMobile
  915. && <OverflowMenuItem
  916. accessibilityLabel = { t('toolbar.accessibilityLabel.fullScreen') }
  917. icon = { _fullScreen ? IconExitFullScreen : IconFullScreen }
  918. key = 'fullscreen'
  919. onClick = { this._onToolbarToggleFullScreen }
  920. text = { _fullScreen ? t('toolbar.exitFullScreen') : t('toolbar.enterFullScreen') } />,
  921. (this.props._shouldShowButton('security') || this.props._shouldShowButton('info'))
  922. && <SecurityDialogButton
  923. key = 'security'
  924. showLabel = { true } />,
  925. this.props._shouldShowButton('closedcaptions')
  926. && <ClosedCaptionButton
  927. key = 'closed-captions'
  928. showLabel = { true } />,
  929. this.props._shouldShowButton('recording')
  930. && <RecordButton
  931. key = 'record'
  932. showLabel = { true } />,
  933. this.props._shouldShowButton('localrecording')
  934. && <OverflowMenuItem
  935. accessibilityLabel = { t('toolbar.accessibilityLabel.localRecording') }
  936. icon = { IconRec }
  937. key = 'localrecording'
  938. onClick = { this._onToolbarOpenLocalRecordingInfoDialog }
  939. text = { t('localRecording.dialogTitle') } />,
  940. this.props._shouldShowButton('mute-everyone')
  941. && <MuteEveryoneButton
  942. key = 'mute-everyone'
  943. showLabel = { true } />,
  944. this.props._shouldShowButton('mute-video-everyone')
  945. && <MuteEveryonesVideoButton
  946. key = 'mute-video-everyone'
  947. showLabel = { true } />,
  948. this.props._shouldShowButton('livestreaming')
  949. && <LiveStreamButton
  950. key = 'livestreaming'
  951. showLabel = { true } />
  952. ];
  953. const group2 = [
  954. this.props._shouldShowButton('sharedvideo')
  955. && <SharedVideoButton
  956. key = 'sharedvideo'
  957. showLabel = { true } />,
  958. this.props._shouldShowButton('shareaudio')
  959. && _desktopSharingEnabled
  960. && isScreenAudioSupported()
  961. && <OverflowMenuItem
  962. accessibilityLabel = { t('toolbar.accessibilityLabel.shareaudio') }
  963. icon = { IconShareAudio }
  964. key = 'shareaudio'
  965. onClick = { this._onToolbarToggleShareAudio }
  966. text = { t('toolbar.shareaudio') } />,
  967. this.props._shouldShowButton('etherpad')
  968. && <SharedDocumentButton
  969. key = 'etherpad'
  970. showLabel = { true } />,
  971. (this.props._shouldShowButton('select-background') || this.props._shouldShowButton('videobackgroundblur'))
  972. && <VideoBackgroundButton
  973. key = { 'select-background' }
  974. showLabel = { true }
  975. visible = { !_screensharing && checkBlurSupport() } />,
  976. this.props._shouldShowButton('stats')
  977. && <OverflowMenuItem
  978. accessibilityLabel = { t('toolbar.accessibilityLabel.speakerStats') }
  979. icon = { IconPresentation }
  980. key = 'stats'
  981. onClick = { this._onToolbarOpenSpeakerStats }
  982. text = { t('toolbar.speakerStats') } />
  983. ];
  984. return [
  985. this._isProfileVisible()
  986. && <OverflowMenuProfileItem
  987. key = 'profile'
  988. onClick = { this._onToolbarToggleProfile } />,
  989. this._isProfileVisible()
  990. && <hr
  991. className = 'overflow-menu-hr'
  992. key = 'hr1' />,
  993. ...group1,
  994. group1.some(Boolean)
  995. && <hr
  996. className = 'overflow-menu-hr'
  997. key = 'hr2' />,
  998. ...group2,
  999. group2.some(Boolean)
  1000. && <hr
  1001. className = 'overflow-menu-hr'
  1002. key = 'hr3' />,
  1003. this.props._shouldShowButton('settings')
  1004. && <SettingsButton
  1005. key = 'settings'
  1006. showLabel = { true } />,
  1007. this.props._shouldShowButton('shortcuts')
  1008. && !_isMobile
  1009. && keyboardShortcut.getEnabled()
  1010. && <OverflowMenuItem
  1011. accessibilityLabel = { t('toolbar.accessibilityLabel.shortcuts') }
  1012. icon = { IconDeviceDocument }
  1013. key = 'shortcuts'
  1014. onClick = { this._onToolbarOpenKeyboardShortcuts }
  1015. text = { t('toolbar.shortcuts') } />,
  1016. this._isEmbedMeetingVisible()
  1017. && <OverflowMenuItem
  1018. accessibilityLabel = { t('toolbar.accessibilityLabel.embedMeeting') }
  1019. icon = { IconCodeBlock }
  1020. key = 'embed'
  1021. onClick = { this._onToolbarOpenEmbedMeeting }
  1022. text = { t('toolbar.embedMeeting') } />,
  1023. this.props._shouldShowButton('feedback')
  1024. && _feedbackConfigured
  1025. && <OverflowMenuItem
  1026. accessibilityLabel = { t('toolbar.accessibilityLabel.feedback') }
  1027. icon = { IconFeedback }
  1028. key = 'feedback'
  1029. onClick = { this._onToolbarOpenFeedback }
  1030. text = { t('toolbar.feedback') } />,
  1031. this.props._shouldShowButton('download')
  1032. && <DownloadButton
  1033. key = 'download'
  1034. showLabel = { true } />,
  1035. this.props._shouldShowButton('help')
  1036. && <HelpButton
  1037. key = 'help'
  1038. showLabel = { true } />
  1039. ];
  1040. }
  1041. /**
  1042. * Returns the buttons to be displayed in main or the overflow menu.
  1043. *
  1044. * @param {Set} buttons - A set containing the buttons to be displayed
  1045. * in the toolbar beside the main audio/video & hanugup.
  1046. * @returns {Object}
  1047. */
  1048. _getAdditionalButtons(buttons) {
  1049. const {
  1050. _chatOpen,
  1051. _desktopSharingEnabled,
  1052. _desktopSharingDisabledTooltipKey,
  1053. _screensharing,
  1054. t
  1055. } = this.props;
  1056. const overflowMenuAdditionalButtons = [];
  1057. const mainMenuAdditionalButtons = [];
  1058. if (this._showDesktopSharingButton()) {
  1059. buttons.has('desktop')
  1060. ? mainMenuAdditionalButtons.push(<ToolbarButton
  1061. accessibilityLabel = { t('toolbar.accessibilityLabel.shareYourScreen') }
  1062. disabled = { !_desktopSharingEnabled }
  1063. icon = { IconShareDesktop }
  1064. key = 'desktop'
  1065. onClick = { this._onToolbarToggleScreenshare }
  1066. toggled = { _screensharing }
  1067. tooltip = { t(_desktopSharingEnabled
  1068. ? 'dialog.shareYourScreen' : _desktopSharingDisabledTooltipKey) } />)
  1069. : overflowMenuAdditionalButtons.push(<OverflowMenuItem
  1070. accessibilityLabel = { t('toolbar.accessibilityLabel.shareYourScreen') }
  1071. icon = { IconShareDesktop }
  1072. iconId = 'share-desktop'
  1073. key = 'desktop'
  1074. onClick = { this._onToolbarToggleScreenshare }
  1075. text = { t(`toolbar.${_screensharing ? 'stopScreenSharing' : 'startScreenSharing'}`) } />);
  1076. }
  1077. if (this.props._shouldShowButton('chat')) {
  1078. buttons.has('chat')
  1079. ? mainMenuAdditionalButtons.push(<div
  1080. className = 'toolbar-button-with-badge'
  1081. key = 'chatcontainer'>
  1082. <ToolbarButton
  1083. accessibilityLabel = { t('toolbar.accessibilityLabel.chat') }
  1084. icon = { IconChat }
  1085. key = 'chat'
  1086. onClick = { this._onToolbarToggleChat }
  1087. toggled = { _chatOpen }
  1088. tooltip = { t('toolbar.chat') } />
  1089. <ChatCounter />
  1090. </div>) : overflowMenuAdditionalButtons.push(<OverflowMenuItem
  1091. accessibilityLabel = { t('toolbar.accessibilityLabel.chat') }
  1092. icon = { IconChat }
  1093. key = 'chat'
  1094. onClick = { this._onToolbarToggleChat }
  1095. text = { t(`toolbar.${_chatOpen ? 'closeChat' : 'openChat'}`) } />);
  1096. }
  1097. if (this.props._shouldShowButton('raisehand')) {
  1098. const raisedHand = this.props._raisedHand || false;
  1099. buttons.has('raisehand')
  1100. ? mainMenuAdditionalButtons.push(<ToolbarButton
  1101. accessibilityLabel = { t('toolbar.accessibilityLabel.raiseHand') }
  1102. icon = { IconRaisedHand }
  1103. key = 'raisehand'
  1104. onClick = { this._onToolbarToggleRaiseHand }
  1105. toggled = { raisedHand }
  1106. tooltip = { t(`toolbar.${raisedHand ? 'lowerYourHand' : 'raiseYourHand'}`) } />)
  1107. : overflowMenuAdditionalButtons.push(<OverflowMenuItem
  1108. accessibilityLabel = { t('toolbar.accessibilityLabel.raiseHand') }
  1109. icon = { IconRaisedHand }
  1110. key = 'raisehand'
  1111. onClick = { this._onToolbarToggleRaiseHand }
  1112. text = { t(`toolbar.${raisedHand ? 'lowerYourHand' : 'raiseYourHand'}`) } />);
  1113. }
  1114. if (this.props._shouldShowButton('participants-pane') || this.props._shouldShowButton('invite')) {
  1115. buttons.has('participants-pane')
  1116. ? mainMenuAdditionalButtons.push(
  1117. <ToolbarButton
  1118. accessibilityLabel = { t('toolbar.accessibilityLabel.participants') }
  1119. icon = { IconParticipants }
  1120. onClick = { this._onToolbarToggleParticipantsPane }
  1121. toggled = { this.props._participantsPaneOpen }
  1122. tooltip = { t('toolbar.participants') } />)
  1123. : overflowMenuAdditionalButtons.push(
  1124. <OverflowMenuItem
  1125. accessibilityLabel = { t('toolbar.accessibilityLabel.participants') }
  1126. icon = { IconParticipants }
  1127. key = 'participants-pane'
  1128. onClick = { this._onToolbarToggleParticipantsPane }
  1129. text = { t('toolbar.participants') } />
  1130. );
  1131. }
  1132. if (this.props._shouldShowButton('tileview')) {
  1133. buttons.has('tileview')
  1134. ? mainMenuAdditionalButtons.push(
  1135. <TileViewButton
  1136. key = 'tileview'
  1137. showLabel = { false } />)
  1138. : overflowMenuAdditionalButtons.push(
  1139. <TileViewButton
  1140. key = 'tileview'
  1141. showLabel = { true } />);
  1142. }
  1143. return {
  1144. mainMenuAdditionalButtons,
  1145. overflowMenuAdditionalButtons
  1146. };
  1147. }
  1148. /**
  1149. * Renders the Audio controlling button.
  1150. *
  1151. * @returns {ReactElement}
  1152. */
  1153. _renderAudioButton() {
  1154. return this.props._shouldShowButton('microphone')
  1155. ? <AudioSettingsButton
  1156. key = 'asb'
  1157. visible = { true } />
  1158. : null;
  1159. }
  1160. /**
  1161. * Renders the Video controlling button.
  1162. *
  1163. * @returns {ReactElement}
  1164. */
  1165. _renderVideoButton() {
  1166. return this.props._shouldShowButton('camera')
  1167. ? <VideoSettingsButton
  1168. key = 'vsb'
  1169. visible = { true } />
  1170. : null;
  1171. }
  1172. /**
  1173. * Renders the toolbox content.
  1174. *
  1175. * @returns {ReactElement}
  1176. */
  1177. _renderToolboxContent() {
  1178. const {
  1179. _clientWidth,
  1180. _isMobile,
  1181. _overflowMenuVisible,
  1182. t
  1183. } = this.props;
  1184. const buttonSet = getToolbarAdditionalButtons(_clientWidth, _isMobile);
  1185. const toolbarAccLabel = 'toolbar.accessibilityLabel.moreActionsMenu';
  1186. const showOverflowMenuButton = buttonSet.has('overflow');
  1187. const containerClassName = `toolbox-content${_isMobile ? ' toolbox-content-mobile' : ''}`;
  1188. let overflowMenuAdditionalButtons = [];
  1189. let mainMenuAdditionalButtons = [];
  1190. if (showOverflowMenuButton) {
  1191. ({ overflowMenuAdditionalButtons, mainMenuAdditionalButtons } = this._getAdditionalButtons(buttonSet));
  1192. }
  1193. return (
  1194. <div className = { containerClassName }>
  1195. <div
  1196. className = 'toolbox-content-wrapper'
  1197. onFocus = { this._onTabIn }
  1198. onMouseOut = { this._onMouseOut }
  1199. onMouseOver = { this._onMouseOver }>
  1200. <div className = 'toolbox-content-items'>
  1201. { this._renderAudioButton() }
  1202. { this._renderVideoButton() }
  1203. { mainMenuAdditionalButtons }
  1204. { showOverflowMenuButton && <OverflowMenuButton
  1205. ariaControls = 'overflow-menu'
  1206. isOpen = { _overflowMenuVisible }
  1207. onVisibilityChange = { this._onSetOverflowVisible }>
  1208. <ul
  1209. aria-label = { t(toolbarAccLabel) }
  1210. className = 'overflow-menu'
  1211. id = 'overflow-menu'
  1212. onKeyDown = { this._onEscKey }
  1213. role = 'menu'>
  1214. { this._renderOverflowMenuContent(overflowMenuAdditionalButtons) }
  1215. </ul>
  1216. </OverflowMenuButton>}
  1217. <HangupButton
  1218. customClass = 'hangup-button'
  1219. visible = { this.props._shouldShowButton('hangup') } />
  1220. </div>
  1221. </div>
  1222. </div>
  1223. );
  1224. }
  1225. }
  1226. /**
  1227. * Maps (parts of) the redux state to {@link Toolbox}'s React {@code Component}
  1228. * props.
  1229. *
  1230. * @param {Object} state - The redux store/state.
  1231. * @private
  1232. * @returns {{}}
  1233. */
  1234. function _mapStateToProps(state) {
  1235. const { conference, locked } = state['features/base/conference'];
  1236. let desktopSharingEnabled = JitsiMeetJS.isDesktopSharingEnabled();
  1237. const {
  1238. callStatsID,
  1239. enableFeaturesBasedOnToken
  1240. } = state['features/base/config'];
  1241. const {
  1242. fullScreen,
  1243. overflowMenuVisible
  1244. } = state['features/toolbox'];
  1245. const localParticipant = getLocalParticipant(state);
  1246. const localRecordingStates = state['features/local-recording'];
  1247. const localVideo = getLocalVideoTrack(state['features/base/tracks']);
  1248. const { clientWidth } = state['features/base/responsive-ui'];
  1249. let desktopSharingDisabledTooltipKey;
  1250. if (enableFeaturesBasedOnToken) {
  1251. // we enable desktop sharing if any participant already have this
  1252. // feature enabled
  1253. desktopSharingEnabled = getParticipants(state)
  1254. .find(({ features = {} }) =>
  1255. String(features['screen-sharing']) === 'true') !== undefined;
  1256. desktopSharingDisabledTooltipKey = 'dialog.shareYourScreenDisabled';
  1257. }
  1258. return {
  1259. _chatOpen: state['features/chat'].isOpen,
  1260. _clientWidth: clientWidth,
  1261. _conference: conference,
  1262. _desktopSharingEnabled: desktopSharingEnabled,
  1263. _backgroundType: state['features/virtual-background'].backgroundType,
  1264. _virtualSource: state['features/virtual-background'].virtualSource,
  1265. _desktopSharingDisabledTooltipKey: desktopSharingDisabledTooltipKey,
  1266. _dialog: Boolean(state['features/base/dialog'].component),
  1267. _feedbackConfigured: Boolean(callStatsID),
  1268. _isProfileDisabled: Boolean(state['features/base/config'].disableProfile),
  1269. _isMobile: isMobileBrowser(),
  1270. _isVpaasMeeting: isVpaasMeeting(state),
  1271. _fullScreen: fullScreen,
  1272. _tileViewEnabled: shouldDisplayTileView(state),
  1273. _localParticipantID: localParticipant.id,
  1274. _localVideo: localVideo,
  1275. _localRecState: localRecordingStates,
  1276. _locked: locked,
  1277. _overflowMenuVisible: overflowMenuVisible,
  1278. _participantsPaneOpen: getParticipantsPaneOpen(state),
  1279. _raisedHand: localParticipant.raisedHand,
  1280. _screensharing: (localVideo && localVideo.videoType === 'desktop') || isScreenAudioShared(state),
  1281. _shouldShowButton: buttonName => isToolbarButtonEnabled(buttonName)(state),
  1282. _visible: isToolboxVisible(state),
  1283. _visibleButtons: getToolbarButtons(state)
  1284. };
  1285. }
  1286. export default translate(connect(_mapStateToProps)(Toolbox));