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 45KB

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