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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. /**
  29. * Handles clicking / pressing the button, and opens a confirmation dialog.
  30. *
  31. * @private
  32. * @returns {void}
  33. */
  34. _handleClick() {
  35. const { dispatch, localParticipantId } = this.props;
  36. sendAnalytics(createToolbarEvent('mute.everyone.pressed'));
  37. dispatch(openDialog(MuteEveryonesVideoDialog, {
  38. exclude: [ localParticipantId ]
  39. }));
  40. }
  41. }
  42. /**
  43. * Maps part of the redux state to the component's props.
  44. *
  45. * @param {Object} state - The redux store/state.
  46. * @param {Props} ownProps - The component's own props.
  47. * @returns {Object}
  48. */
  49. function _mapStateToProps(state: Object, ownProps: Props) {
  50. const localParticipant = getLocalParticipant(state);
  51. const { disableRemoteMute } = state['features/base/config'];
  52. const { visible = isLocalParticipantModerator(state) && !disableRemoteMute } = ownProps;
  53. return {
  54. localParticipantId: localParticipant.id,
  55. visible
  56. };
  57. }
  58. export default translate(connect(_mapStateToProps)(MuteEveryonesVideoButton));