You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Toolbox.js 44KB

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