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. export default class AbstractVideoMuteButton<P : Props, S : *>
  8. extends AbstractButton<P, S> {
  9. accessibilityLabel = 'Video mute';
  10. iconName = 'icon-camera';
  11. toggledIconName = 'icon-camera-disabled toggled';
  12. /**
  13. * Handles clicking / pressing the button, and toggles the video mute state
  14. * accordingly.
  15. *
  16. * @private
  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. * @private
  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. * boolean value indicating if video is muted or not.
  35. *
  36. * @abstract
  37. * @private
  38. * @returns {boolean}
  39. */
  40. _isVideoMuted() {
  41. // To be implemented by subclass.
  42. }
  43. /**
  44. * Helper function to perform the actual setting of the video mute / unmute
  45. * action.
  46. *
  47. * @param {boolean} videoMuted - Whether video should be muted or not.
  48. * @private
  49. * @returns {void}
  50. */
  51. _setVideoMuted(videoMuted: boolean) { // eslint-disable-line no-unused-vars
  52. // To be implemented by subclass.
  53. }
  54. }