您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

AbstractAudioMuteButton.js 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. 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. * @protected
  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. * @protected
  27. * @returns {boolean}
  28. */
  29. _isAudioMuted() {
  30. // To be implemented by subclass.
  31. }
  32. /**
  33. * Indicates whether this button is in toggled state or not.
  34. *
  35. * @override
  36. * @protected
  37. * @returns {boolean}
  38. */
  39. _isToggled() {
  40. return this._isAudioMuted();
  41. }
  42. /**
  43. * Helper function to perform the actual setting of the audio mute / unmute
  44. * action.
  45. *
  46. * @param {boolean} audioMuted - Whether video should be muted or not.
  47. * @protected
  48. * @returns {void}
  49. */
  50. _setAudioMuted(audioMuted: boolean) { // eslint-disable-line no-unused-vars
  51. // To be implemented by subclass.
  52. }
  53. }