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

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