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 AbstractButton from './AbstractButton';
  3. import type { Props } from './AbstractButton';
  4. /**
  5. * An abstract implementation of a button for toggling video mute.
  6. */
  7. class AbstractVideoMuteButton<P : Props, S : *> extends AbstractButton<P, S> {
  8. accessibilityLabel = 'Video mute';
  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. * @private
  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. * @private
  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. * boolean value indicating if video is muted or not.
  34. *
  35. * @abstract
  36. * @private
  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. * @private
  48. * @returns {void}
  49. */
  50. _setVideoMuted(videoMuted: boolean) { // eslint-disable-line no-unused-vars
  51. // To be implemented by subclass.
  52. }
  53. }
  54. export default AbstractVideoMuteButton;