您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

Toolbox.js 45KB

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