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.

MuteButton.js 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import React, { Component } from 'react';
  2. import { translate } from '../../base/i18n';
  3. import RemoteVideoMenuButton from './RemoteVideoMenuButton';
  4. /**
  5. * Implements a React {@link Component} which displays a button for audio muting
  6. * a participant in the conference.
  7. *
  8. * @extends Component
  9. */
  10. class MuteButton extends Component {
  11. /**
  12. * {@code MuteButton} component's property types.
  13. *
  14. * @static
  15. */
  16. static propTypes = {
  17. /**
  18. * Whether or not the participant is currently audio muted.
  19. */
  20. isAudioMuted: React.PropTypes.bool,
  21. /**
  22. * The callback to invoke when the component is clicked.
  23. */
  24. onClick: React.PropTypes.func,
  25. /**
  26. * The ID of the participant linked to the onClick callback.
  27. */
  28. participantID: React.PropTypes.string,
  29. /**
  30. * Invoked to obtain translated strings.
  31. */
  32. t: React.PropTypes.func
  33. };
  34. /**
  35. * Implements React's {@link Component#render()}.
  36. *
  37. * @inheritdoc
  38. * @returns {ReactElement}
  39. */
  40. render() {
  41. const { isAudioMuted, onClick, participantID, t } = this.props;
  42. const muteConfig = isAudioMuted ? {
  43. translationKey: 'videothumbnail.muted',
  44. muteClassName: 'mutelink disabled'
  45. } : {
  46. translationKey: 'videothumbnail.domute',
  47. muteClassName: 'mutelink'
  48. };
  49. return (
  50. <RemoteVideoMenuButton
  51. buttonText = { t(muteConfig.translationKey) }
  52. displayClass = { muteConfig.muteClassName }
  53. iconClass = 'icon-mic-disabled'
  54. id = { `mutelink_${participantID}` }
  55. onClick = { onClick } />
  56. );
  57. }
  58. }
  59. export default translate(MuteButton);