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

63 lines
1.5 KiB
JavaScript
Raw Normal View History

// @flow
2019-08-30 16:39:06 +00:00
import { IconMicDisabled, IconMicrophone } from '../../icons';
import AbstractButton from './AbstractButton';
import type { Props } from './AbstractButton';
/**
* An abstract implementation of a button for toggling audio mute.
*/
export default class AbstractAudioMuteButton<P: Props, S: *>
extends AbstractButton<P, S> {
2019-08-30 16:39:06 +00:00
icon = IconMicrophone;
toggledIcon = IconMicDisabled;
/**
* Handles clicking / pressing the button, and toggles the audio mute state
* accordingly.
*
* @override
2018-05-11 02:10:26 +00:00
* @protected
* @returns {void}
*/
_handleClick() {
this._setAudioMuted(!this._isAudioMuted());
}
/**
* Helper function to be implemented by subclasses, which must return a
* boolean value indicating if audio is muted or not.
*
2018-05-11 02:10:26 +00:00
* @protected
* @returns {boolean}
*/
_isAudioMuted() {
// To be implemented by subclass.
}
/**
* 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._isAudioMuted();
}
/**
* Helper function to perform the actual setting of the audio mute / unmute
* action.
*
* @param {boolean} audioMuted - Whether video should be muted or not.
2018-05-11 02:10:26 +00:00
* @protected
* @returns {void}
*/
_setAudioMuted(audioMuted: boolean) { // eslint-disable-line no-unused-vars
// To be implemented by subclass.
}
}