Files
upstream-jitsi-meet/react/features/base/toolbox/components/BaseAudioMuteButton.ts
upstream-mirror 1d2bfcac0c
Some checks failed
Prosody Plugin Tests / test (push) Failing after 10m11s
Close stale issues and PRs / stale (push) Failing after 1s
snapshot of https://github.com/jitsi/jitsi-meet.git @ fd1749dd28f4138aa80234fc7f311b19aaffa0e7 (2026-09-15)
2026-09-15 15:56:32 +05:00

61 lines
1.4 KiB
TypeScript

import { IconMic, IconMicSlash } from '../../icons/svg';
import AbstractButton, { IProps } from './AbstractButton';
/**
* An abstract implementation of a button for toggling audio mute.
*/
export default class BaseAudioMuteButton<P extends IProps, S=any>
extends AbstractButton<P, S> {
override icon = IconMic;
override toggledIcon = IconMicSlash;
/**
* Handles clicking / pressing the button, and toggles the audio mute state
* accordingly.
*
* @override
* @protected
* @returns {void}
*/
override _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.
*
* @protected
* @returns {boolean}
*/
_isAudioMuted() {
// To be implemented by subclass.
return false;
}
/**
* Indicates whether this button is in toggled state or not.
*
* @override
* @protected
* @returns {boolean}
*/
override _isToggled() {
return this._isAudioMuted();
}
/**
* Helper function to perform the actual setting of the audio mute / unmute
* action.
*
* @param {boolean} _audioMuted - Whether audio should be muted or not.
* @protected
* @returns {void}
*/
_setAudioMuted(_audioMuted: boolean) {
// To be implemented by subclass.
}
}