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.3KB

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