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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. * @protected
  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. * @protected
  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. * @protected
  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. * @protected
  49. * @returns {void}
  50. */
  51. _setAudioMuted(audioMuted: boolean) { // eslint-disable-line no-unused-vars
  52. // To be implemented by subclass.
  53. }
  54. }