2018-04-11 20:04:40 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import React, { Component } from 'react';
|
|
|
|
|
2020-06-04 14:09:13 +00:00
|
|
|
import { VIDEO_QUALITY_LEVELS } from '../../base/conference/constants';
|
2018-04-11 20:04:40 +00:00
|
|
|
import { translate } from '../../base/i18n';
|
2019-08-30 16:39:06 +00:00
|
|
|
import {
|
|
|
|
Icon,
|
|
|
|
IconVideoQualityAudioOnly,
|
|
|
|
IconVideoQualityHD,
|
|
|
|
IconVideoQualityLD,
|
|
|
|
IconVideoQualitySD
|
|
|
|
} from '../../base/icons';
|
2019-03-21 16:38:29 +00:00
|
|
|
import { connect } from '../../base/redux';
|
2018-04-11 20:04:40 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A map of of selectable receive resolutions to corresponding icons.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @type {Object}
|
|
|
|
*/
|
|
|
|
const VIDEO_QUALITY_TO_ICON = {
|
2019-08-30 16:39:06 +00:00
|
|
|
[VIDEO_QUALITY_LEVELS.HIGH]: IconVideoQualityHD,
|
|
|
|
[VIDEO_QUALITY_LEVELS.STANDARD]: IconVideoQualitySD,
|
|
|
|
[VIDEO_QUALITY_LEVELS.LOW]: IconVideoQualityLD
|
2018-04-11 20:04:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The type of the React {@code Component} props of
|
|
|
|
* {@link OverflowMenuVideoQualityItem}.
|
|
|
|
*/
|
|
|
|
type Props = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether or not audio only mode is currently enabled.
|
|
|
|
*/
|
|
|
|
_audioOnly: boolean,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The currently configured maximum quality resolution to be received from
|
2020-04-28 02:51:40 +00:00
|
|
|
* and sent to remote participants.
|
2018-04-11 20:04:40 +00:00
|
|
|
*/
|
2020-04-28 02:51:40 +00:00
|
|
|
_videoQuality: number,
|
2018-04-11 20:04:40 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback to invoke when {@link OverflowMenuVideoQualityItem} is clicked.
|
|
|
|
*/
|
|
|
|
onClick: Function,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Invoked to obtain translated strings.
|
|
|
|
*/
|
|
|
|
t: Function
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* React {@code Component} responsible for displaying a button in the overflow
|
|
|
|
* menu of the toolbar, including an icon showing the currently selected
|
|
|
|
* max receive quality.
|
|
|
|
*
|
|
|
|
* @extends Component
|
|
|
|
*/
|
|
|
|
class OverflowMenuVideoQualityItem extends Component<Props> {
|
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
2020-04-28 02:51:40 +00:00
|
|
|
const { _audioOnly, _videoQuality } = this.props;
|
|
|
|
const icon = _audioOnly || !_videoQuality
|
2019-08-30 16:39:06 +00:00
|
|
|
? IconVideoQualityAudioOnly
|
2020-04-28 02:51:40 +00:00
|
|
|
: VIDEO_QUALITY_TO_ICON[_videoQuality];
|
2018-04-11 20:04:40 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<li
|
2018-06-07 20:32:18 +00:00
|
|
|
aria-label =
|
|
|
|
{ this.props.t('toolbar.accessibilityLabel.callQuality') }
|
2018-04-11 20:04:40 +00:00
|
|
|
className = 'overflow-menu-item'
|
|
|
|
onClick = { this.props.onClick }>
|
|
|
|
<span className = 'overflow-menu-item-icon'>
|
2019-08-30 16:39:06 +00:00
|
|
|
<Icon src = { icon } />
|
2018-04-11 20:04:40 +00:00
|
|
|
</span>
|
|
|
|
<span className = 'profile-text'>
|
|
|
|
{ this.props.t('toolbar.callQuality') }
|
|
|
|
</span>
|
|
|
|
</li>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps (parts of) the Redux state to the associated props for the
|
|
|
|
* {@code OverflowMenuVideoQualityItem} component.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The Redux state.
|
|
|
|
* @private
|
|
|
|
* @returns {{
|
|
|
|
* _audioOnly: boolean,
|
2020-04-28 02:51:40 +00:00
|
|
|
* _videoQuality: number
|
2018-04-11 20:04:40 +00:00
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
function _mapStateToProps(state) {
|
|
|
|
return {
|
2019-07-31 12:47:52 +00:00
|
|
|
_audioOnly: state['features/base/audio-only'].enabled,
|
2020-04-28 02:51:40 +00:00
|
|
|
_videoQuality: state['features/base/conference'].preferredVideoQuality
|
2018-04-11 20:04:40 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export default translate(
|
|
|
|
connect(_mapStateToProps)(OverflowMenuVideoQualityItem));
|