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.

AbstractAudioMuteButton.js 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // @flow
  2. import AbstractButton from './AbstractButton';
  3. import type { Props } from './AbstractButton';
  4. /**
  5. * An abstract implementation of a button for toggling audio mute.
  6. */
  7. class AbstractAudioMuteButton<P: Props, S: *> extends AbstractButton<P, S> {
  8. accessibilityLabel = 'Audio mute';
  9. iconName = 'icon-microphone';
  10. toggledIconName = 'icon-mic-disabled toggled';
  11. /**
  12. * Handles clicking / pressing the button, and toggles the audio mute state
  13. * accordingly.
  14. *
  15. * @override
  16. * @private
  17. * @returns {void}
  18. */
  19. _handleClick() {
  20. this._setAudioMuted(!this._isAudioMuted());
  21. }
  22. /**
  23. * Helper function to be implemented by subclasses, which must return a
  24. * boolean value indicating if audio is muted or not.
  25. *
  26. * @abstract
  27. * @private
  28. * @returns {boolean}
  29. */
  30. _isAudioMuted() {
  31. // To be implemented by subclass.
  32. }
  33. /**
  34. * Indicates whether this button is in toggled state or not.
  35. *
  36. * @override
  37. * @private
  38. * @returns {boolean}
  39. */
  40. _isToggled() {
  41. return this._isAudioMuted();
  42. }
  43. /**
  44. * Helper function to perform the actual setting of the audio mute / unmute
  45. * action.
  46. *
  47. * @param {boolean} audioMuted - Whether video should be muted or not.
  48. * @private
  49. * @returns {void}
  50. */
  51. _setAudioMuted(audioMuted: boolean) { // eslint-disable-line no-unused-vars
  52. // To be implemented by subclass.
  53. }
  54. }
  55. export default AbstractAudioMuteButton;