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

AbstractVideoMuteButton.js 1.4KB

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