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.

AbstractVideoMuteButton.js 1.5KB

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