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

Toolbox.js 44KB

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