jiti-meet/react/features/base/toolbox/components/AbstractVideoMuteButton.js

62 lines
1.5 KiB
JavaScript
Raw Normal View History

// @flow
2019-08-30 16:39:06 +00:00
import { IconCamera, IconCameraDisabled } 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> {
2019-08-30 16:39:06 +00:00
icon = IconCamera;
toggledIcon = IconCameraDisabled;
/**
* Handles clicking / pressing the button, and toggles the video mute state
* accordingly.
*
2018-05-11 02:10:26 +00:00
* @protected
* @returns {void}
*/
_handleClick() {
this._setVideoMuted(!this._isVideoMuted());
}
/**
* Indicates whether this button is in toggled state or not.
*
* @override
2018-05-11 02:10:26 +00:00
* @protected
* @returns {boolean}
*/
_isToggled() {
return this._isVideoMuted();
}
/**
* Helper function to be implemented by subclasses, which must return a
2018-05-11 02:10:26 +00:00
* {@code boolean} value indicating if video is muted or not.
*
2018-05-11 02:10:26 +00:00
* @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.
2018-05-11 02:10:26 +00:00
* @protected
* @returns {void}
*/
_setVideoMuted(videoMuted: boolean) { // eslint-disable-line no-unused-vars
// To be implemented by subclass.
}
}