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.

MuteVideoButton.js 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* @flow */
  2. import React from 'react';
  3. import { translate } from '../../../base/i18n';
  4. import { IconCameraDisabled } from '../../../base/icons';
  5. import { connect } from '../../../base/redux';
  6. import AbstractMuteVideoButton, {
  7. _mapStateToProps,
  8. type Props
  9. } from '../AbstractMuteVideoButton';
  10. import RemoteVideoMenuButton from './RemoteVideoMenuButton';
  11. /**
  12. * Implements a React {@link Component} which displays a button for disabling
  13. * the camera of a participant in the conference.
  14. *
  15. * NOTE: At the time of writing this is a button that doesn't use the
  16. * {@code AbstractButton} base component, but is inherited from the same
  17. * super class ({@code AbstractMuteVideoButton} that extends {@code AbstractButton})
  18. * for the sake of code sharing between web and mobile. Once web uses the
  19. * {@code AbstractButton} base component, this can be fully removed.
  20. */
  21. class MuteVideoButton extends AbstractMuteVideoButton {
  22. /**
  23. * Instantiates a new {@code Component}.
  24. *
  25. * @inheritdoc
  26. */
  27. constructor(props: Props) {
  28. super(props);
  29. this._handleClick = this._handleClick.bind(this);
  30. }
  31. /**
  32. * Implements React's {@link Component#render()}.
  33. *
  34. * @inheritdoc
  35. * @returns {ReactElement}
  36. */
  37. render() {
  38. const { _videoTrackMuted, participantID, t } = this.props;
  39. const muteConfig = _videoTrackMuted ? {
  40. translationKey: 'videothumbnail.videoMuted',
  41. muteClassName: 'mutelink disabled'
  42. } : {
  43. translationKey: 'videothumbnail.domuteVideo',
  44. muteClassName: 'mutelink'
  45. };
  46. return (
  47. <RemoteVideoMenuButton
  48. buttonText = { t(muteConfig.translationKey) }
  49. displayClass = { muteConfig.muteClassName }
  50. icon = { IconCameraDisabled }
  51. id = { `mutelink_${participantID}` }
  52. // eslint-disable-next-line react/jsx-handler-names
  53. onClick = { this._handleClick } />
  54. );
  55. }
  56. _handleClick: () => void
  57. }
  58. export default translate(connect(_mapStateToProps)(MuteVideoButton));