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