2018-03-07 00:28:19 +00:00
|
|
|
// @flow
|
|
|
|
|
2018-04-13 13:03:12 +00:00
|
|
|
import AbstractButton from './AbstractButton';
|
|
|
|
import type { Props } from './AbstractButton';
|
2018-03-07 00:28:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* An abstract implementation of a button for toggling video mute.
|
|
|
|
*/
|
2018-05-10 23:01:55 +00:00
|
|
|
export default class AbstractVideoMuteButton<P : Props, S : *>
|
|
|
|
extends AbstractButton<P, S> {
|
|
|
|
|
2018-04-13 13:03:12 +00:00
|
|
|
iconName = 'icon-camera';
|
|
|
|
toggledIconName = 'icon-camera-disabled toggled';
|
|
|
|
|
2018-03-07 00:28:19 +00:00
|
|
|
/**
|
2018-04-13 13:03:12 +00:00
|
|
|
* Handles clicking / pressing the button, and toggles the video mute state
|
|
|
|
* accordingly.
|
2018-03-07 00:28:19 +00:00
|
|
|
*
|
2018-05-11 02:10:26 +00:00
|
|
|
* @protected
|
2018-04-13 13:03:12 +00:00
|
|
|
* @returns {void}
|
2018-03-07 00:28:19 +00:00
|
|
|
*/
|
2018-04-13 13:03:12 +00:00
|
|
|
_handleClick() {
|
|
|
|
this._setVideoMuted(!this._isVideoMuted());
|
|
|
|
}
|
2018-03-07 00:28:19 +00:00
|
|
|
|
|
|
|
/**
|
2018-04-13 13:03:12 +00:00
|
|
|
* Indicates whether this button is in toggled state or not.
|
2018-03-07 00:28:19 +00:00
|
|
|
*
|
2018-04-13 13:03:12 +00:00
|
|
|
* @override
|
2018-05-11 02:10:26 +00:00
|
|
|
* @protected
|
2018-04-13 13:03:12 +00:00
|
|
|
* @returns {boolean}
|
2018-03-07 00:28:19 +00:00
|
|
|
*/
|
2018-04-13 13:03:12 +00:00
|
|
|
_isToggled() {
|
|
|
|
return this._isVideoMuted();
|
2018-03-07 00:28:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-04-13 13:03:12 +00:00
|
|
|
* 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-03-07 00:28:19 +00:00
|
|
|
*
|
2018-05-11 02:10:26 +00:00
|
|
|
* @protected
|
2018-04-13 13:03:12 +00:00
|
|
|
* @returns {boolean}
|
2018-03-07 00:28:19 +00:00
|
|
|
*/
|
2018-04-13 13:03:12 +00:00
|
|
|
_isVideoMuted() {
|
|
|
|
// To be implemented by subclass.
|
2018-03-07 00:28:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-04-13 13:03:12 +00:00
|
|
|
* Helper function to perform the actual setting of the video mute / unmute
|
|
|
|
* action.
|
2018-03-07 00:28:19 +00:00
|
|
|
*
|
2018-04-13 13:03:12 +00:00
|
|
|
* @param {boolean} videoMuted - Whether video should be muted or not.
|
2018-05-11 02:10:26 +00:00
|
|
|
* @protected
|
2018-03-07 00:28:19 +00:00
|
|
|
* @returns {void}
|
|
|
|
*/
|
2018-04-13 13:03:12 +00:00
|
|
|
_setVideoMuted(videoMuted: boolean) { // eslint-disable-line no-unused-vars
|
|
|
|
// To be implemented by subclass.
|
2018-03-07 00:28:19 +00:00
|
|
|
}
|
|
|
|
}
|