123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- // @flow
-
- import { IconCameraEmpty, IconCameraEmptyDisabled } from '../../icons';
-
- import AbstractButton from './AbstractButton';
- import type { Props } from './AbstractButton';
-
- /**
- * An abstract implementation of a button for toggling video mute.
- */
- export default class AbstractVideoMuteButton<P : Props, S : *>
- extends AbstractButton<P, S> {
-
- icon = IconCameraEmpty;
- toggledIcon = IconCameraEmptyDisabled;
-
- /**
- * Handles clicking / pressing the button, and toggles the video mute state
- * accordingly.
- *
- * @protected
- * @returns {void}
- */
- _handleClick() {
- const { handleClick } = this.props;
-
- if (handleClick) {
- handleClick();
-
- return;
- }
-
- this._setVideoMuted(!this._isVideoMuted());
- }
-
- /**
- * Indicates whether this button is in toggled state or not.
- *
- * @override
- * @protected
- * @returns {boolean}
- */
- _isToggled() {
- return this._isVideoMuted();
- }
-
- /**
- * Helper function to be implemented by subclasses, which must return a
- * {@code boolean} value indicating if video is muted or not.
- *
- * @protected
- * @returns {boolean}
- */
- _isVideoMuted() {
- // To be implemented by subclass.
- }
-
- /**
- * Helper function to perform the actual setting of the video mute / unmute
- * action.
- *
- * @param {boolean} videoMuted - Whether video should be muted or not.
- * @protected
- * @returns {void}
- */
- _setVideoMuted(videoMuted: boolean) { // eslint-disable-line no-unused-vars
- // To be implemented by subclass.
- }
- }
|