2018-05-22 19:47:10 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import React from 'react';
|
2017-04-21 21:14:14 +00:00
|
|
|
|
2021-09-29 12:06:03 +00:00
|
|
|
import { openDialog } from '../../base/dialog';
|
2017-05-15 18:55:08 +00:00
|
|
|
import { translate } from '../../base/i18n';
|
2021-09-29 12:06:03 +00:00
|
|
|
import { IconGauge } from '../../base/icons';
|
2021-04-08 08:35:26 +00:00
|
|
|
import { Label } from '../../base/label';
|
2019-03-21 16:38:29 +00:00
|
|
|
import { connect } from '../../base/redux';
|
2021-02-04 13:24:25 +00:00
|
|
|
import { Tooltip } from '../../base/tooltip';
|
2021-04-08 08:35:26 +00:00
|
|
|
import { shouldDisplayTileView } from '../../video-layout';
|
2017-08-29 15:08:16 +00:00
|
|
|
|
2018-05-22 19:47:10 +00:00
|
|
|
import AbstractVideoQualityLabel, {
|
2022-09-27 07:10:28 +00:00
|
|
|
type Props as AbstractProps,
|
|
|
|
_abstractMapStateToProps
|
2018-05-22 19:47:10 +00:00
|
|
|
} from './AbstractVideoQualityLabel';
|
2021-09-29 12:06:03 +00:00
|
|
|
import VideoQualityDialog from './VideoQualityDialog.web';
|
2018-05-22 19:47:10 +00:00
|
|
|
|
2021-04-08 08:35:26 +00:00
|
|
|
declare var interfaceConfig: Object;
|
|
|
|
|
2018-05-22 19:47:10 +00:00
|
|
|
type Props = AbstractProps & {
|
|
|
|
|
|
|
|
/**
|
2021-09-29 12:06:03 +00:00
|
|
|
* The redux dispatch function.
|
2018-05-22 19:47:10 +00:00
|
|
|
*/
|
2021-09-29 12:06:03 +00:00
|
|
|
dispatch: Function,
|
2021-04-08 08:35:26 +00:00
|
|
|
|
2018-05-22 19:47:10 +00:00
|
|
|
/**
|
|
|
|
* The message to show within the label's tooltip.
|
|
|
|
*/
|
|
|
|
_tooltipKey: string,
|
|
|
|
|
2021-04-08 08:35:26 +00:00
|
|
|
/**
|
|
|
|
* Flag controlling visibility of the component.
|
|
|
|
*/
|
|
|
|
_visible: boolean,
|
2018-05-22 19:47:10 +00:00
|
|
|
};
|
|
|
|
|
2017-04-21 21:14:14 +00:00
|
|
|
/**
|
|
|
|
* React {@code Component} responsible for displaying a label that indicates
|
|
|
|
* the displayed video state of the current conference. {@code AudioOnlyLabel}
|
2021-11-04 21:10:43 +00:00
|
|
|
* Will display when the conference is in audio only mode. {@code HDVideoLabel}
|
|
|
|
* Will display if not in audio only mode and a high-definition large video is
|
2017-04-21 21:14:14 +00:00
|
|
|
* being displayed.
|
|
|
|
*/
|
2018-05-22 19:47:10 +00:00
|
|
|
export class VideoQualityLabel extends AbstractVideoQualityLabel<Props> {
|
2017-05-15 18:55:08 +00:00
|
|
|
|
2017-04-21 21:14:14 +00:00
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
2017-05-15 18:55:08 +00:00
|
|
|
* @returns {ReactElement}
|
2017-04-21 21:14:14 +00:00
|
|
|
*/
|
|
|
|
render() {
|
2017-05-23 18:58:07 +00:00
|
|
|
const {
|
|
|
|
_audioOnly,
|
2021-04-08 08:35:26 +00:00
|
|
|
_visible,
|
2021-09-29 12:06:03 +00:00
|
|
|
dispatch,
|
2017-08-29 20:55:35 +00:00
|
|
|
t
|
2017-05-23 18:58:07 +00:00
|
|
|
} = this.props;
|
2017-05-15 18:55:08 +00:00
|
|
|
|
2018-04-03 16:42:59 +00:00
|
|
|
|
2021-04-08 08:35:26 +00:00
|
|
|
if (!_visible) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2022-02-14 10:43:04 +00:00
|
|
|
let className, icon, labelContent, tooltipKey;
|
2018-04-03 16:42:59 +00:00
|
|
|
|
|
|
|
if (_audioOnly) {
|
2018-05-16 14:00:16 +00:00
|
|
|
className = 'audio-only';
|
|
|
|
labelContent = t('videoStatus.audioOnly');
|
2018-04-03 16:42:59 +00:00
|
|
|
tooltipKey = 'videoStatus.labelTooltipAudioOnly';
|
|
|
|
} else {
|
2018-05-16 14:00:16 +00:00
|
|
|
className = 'current-video-quality';
|
2021-09-29 12:06:03 +00:00
|
|
|
icon = IconGauge;
|
|
|
|
tooltipKey = 'videoStatus.performanceSettings';
|
2018-04-03 16:42:59 +00:00
|
|
|
}
|
|
|
|
|
2022-02-14 10:43:04 +00:00
|
|
|
const onClick = () => dispatch(openDialog(VideoQualityDialog));
|
2017-05-23 18:58:07 +00:00
|
|
|
|
2017-05-15 18:55:08 +00:00
|
|
|
return (
|
2018-05-16 14:00:16 +00:00
|
|
|
<Tooltip
|
|
|
|
content = { t(tooltipKey) }
|
2021-04-08 08:35:26 +00:00
|
|
|
position = { 'bottom' }>
|
|
|
|
<Label
|
2018-05-16 14:00:16 +00:00
|
|
|
className = { className }
|
2021-09-29 12:06:03 +00:00
|
|
|
icon = { icon }
|
2018-05-22 19:44:40 +00:00
|
|
|
id = 'videoResolutionLabel'
|
2022-02-14 10:43:04 +00:00
|
|
|
// eslint-disable-next-line react/jsx-no-bind
|
2021-09-29 12:06:03 +00:00
|
|
|
onClick = { onClick }
|
2021-04-08 08:35:26 +00:00
|
|
|
text = { labelContent } />
|
2018-05-16 14:00:16 +00:00
|
|
|
</Tooltip>
|
2017-05-15 18:55:08 +00:00
|
|
|
);
|
|
|
|
}
|
2018-05-16 14:00:16 +00:00
|
|
|
}
|
2017-05-15 18:55:08 +00:00
|
|
|
|
2017-04-21 21:14:14 +00:00
|
|
|
/**
|
2017-08-09 19:40:03 +00:00
|
|
|
* Maps (parts of) the Redux state to the associated {@code VideoQualityLabel}'s
|
2017-04-21 21:14:14 +00:00
|
|
|
* props.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The Redux state.
|
|
|
|
* @private
|
|
|
|
* @returns {{
|
2021-09-29 12:06:03 +00:00
|
|
|
* _audioOnly: boolean,
|
|
|
|
* _visible: boolean
|
2017-04-21 21:14:14 +00:00
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
function _mapStateToProps(state) {
|
|
|
|
return {
|
2018-05-22 19:47:10 +00:00
|
|
|
..._abstractMapStateToProps(state),
|
2021-04-08 08:35:26 +00:00
|
|
|
_visible: !(shouldDisplayTileView(state) || interfaceConfig.VIDEO_QUALITY_LABEL_DISABLED)
|
2017-04-21 21:14:14 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2017-08-09 19:40:03 +00:00
|
|
|
export default translate(connect(_mapStateToProps)(VideoQualityLabel));
|