選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

BaseVideoMuteButton.ts 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import { IconVideo, IconVideoOff } from '../../icons/svg';
  2. import AbstractButton, { IProps } from './AbstractButton';
  3. /**
  4. * An abstract implementation of a button for toggling video mute.
  5. */
  6. export default class BaseVideoMuteButton<P extends IProps, S=any>
  7. extends AbstractButton<P, S> {
  8. icon = IconVideo;
  9. toggledIcon = IconVideoOff;
  10. /**
  11. * Handles clicking / pressing the button, and toggles the video mute state
  12. * accordingly.
  13. *
  14. * @protected
  15. * @returns {void}
  16. */
  17. _handleClick() {
  18. this._setVideoMuted(!this._isVideoMuted());
  19. }
  20. /**
  21. * Indicates whether this button is in toggled state or not.
  22. *
  23. * @override
  24. * @protected
  25. * @returns {boolean}
  26. */
  27. _isToggled() {
  28. return this._isVideoMuted();
  29. }
  30. /**
  31. * Helper function to be implemented by subclasses, which must return a
  32. * {@code boolean} value indicating if video is muted or not.
  33. *
  34. * @protected
  35. * @returns {boolean}
  36. */
  37. _isVideoMuted() {
  38. // To be implemented by subclass.
  39. return false;
  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) {
  50. // To be implemented by subclass.
  51. }
  52. }