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

Toolbox.js 45KB

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