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.

MuteEveryonesVideoButton.js 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // @flow
  2. import { createToolbarEvent, sendAnalytics } from '../../analytics';
  3. import { openDialog } from '../../base/dialog';
  4. import { translate } from '../../base/i18n';
  5. import { IconMuteVideoEveryone } from '../../base/icons';
  6. import { getLocalParticipant, isLocalParticipantModerator } from '../../base/participants';
  7. import { connect } from '../../base/redux';
  8. import { AbstractButton, type AbstractButtonProps } from '../../base/toolbox/components';
  9. import { MuteEveryonesVideoDialog } from '../../video-menu/components';
  10. type Props = AbstractButtonProps & {
  11. /**
  12. * The Redux dispatch function.
  13. */
  14. dispatch: Function,
  15. /**
  16. * The ID of the local participant.
  17. */
  18. localParticipantId: string
  19. };
  20. /**
  21. * Implements a React {@link Component} which displays a button for disabling the camera of
  22. * every participant (except the local one)
  23. */
  24. class MuteEveryonesVideoButton extends AbstractButton<Props, *> {
  25. accessibilityLabel = 'toolbar.accessibilityLabel.muteEveryonesVideo';
  26. icon = IconMuteVideoEveryone;
  27. label = 'toolbar.muteEveryonesVideo';
  28. tooltip = 'toolbar.muteEveryonesVideo';
  29. /**
  30. * Handles clicking / pressing the button, and opens a confirmation dialog.
  31. *
  32. * @private
  33. * @returns {void}
  34. */
  35. _handleClick() {
  36. const { dispatch, localParticipantId } = this.props;
  37. sendAnalytics(createToolbarEvent('mute.everyone.pressed'));
  38. dispatch(openDialog(MuteEveryonesVideoDialog, {
  39. exclude: [ localParticipantId ]
  40. }));
  41. }
  42. }
  43. /**
  44. * Maps part of the redux state to the component's props.
  45. *
  46. * @param {Object} state - The redux store/state.
  47. * @param {Props} ownProps - The component's own props.
  48. * @returns {Object}
  49. */
  50. function _mapStateToProps(state: Object, ownProps: Props) {
  51. const localParticipant = getLocalParticipant(state);
  52. const { disableRemoteMute } = state['features/base/config'];
  53. const { visible = isLocalParticipantModerator(state) && !disableRemoteMute } = ownProps;
  54. return {
  55. localParticipantId: localParticipant.id,
  56. visible
  57. };
  58. }
  59. export default translate(connect(_mapStateToProps)(MuteEveryonesVideoButton));