|
@@ -0,0 +1,105 @@
|
|
1
|
+// @flow
|
|
2
|
+
|
|
3
|
+import React, { Component } from 'react';
|
|
4
|
+import { connect } from 'react-redux';
|
|
5
|
+
|
|
6
|
+import { VIDEO_QUALITY_LEVELS } from '../../base/conference';
|
|
7
|
+import { translate } from '../../base/i18n';
|
|
8
|
+
|
|
9
|
+/**
|
|
10
|
+ * A map of of selectable receive resolutions to corresponding icons.
|
|
11
|
+ *
|
|
12
|
+ * @private
|
|
13
|
+ * @type {Object}
|
|
14
|
+ */
|
|
15
|
+const VIDEO_QUALITY_TO_ICON = {
|
|
16
|
+ [VIDEO_QUALITY_LEVELS.HIGH]: 'icon-HD',
|
|
17
|
+ [VIDEO_QUALITY_LEVELS.STANDARD]: 'icon-SD',
|
|
18
|
+ [VIDEO_QUALITY_LEVELS.LOW]: 'icon-LD'
|
|
19
|
+};
|
|
20
|
+
|
|
21
|
+/**
|
|
22
|
+ * The type of the React {@code Component} props of
|
|
23
|
+ * {@link OverflowMenuVideoQualityItem}.
|
|
24
|
+ */
|
|
25
|
+type Props = {
|
|
26
|
+
|
|
27
|
+ /**
|
|
28
|
+ * Whether or not audio only mode is currently enabled.
|
|
29
|
+ */
|
|
30
|
+ _audioOnly: boolean,
|
|
31
|
+
|
|
32
|
+ /**
|
|
33
|
+ * The currently configured maximum quality resolution to be received from
|
|
34
|
+ * remote participants.
|
|
35
|
+ */
|
|
36
|
+ _receiveVideoQuality: number,
|
|
37
|
+
|
|
38
|
+ /**
|
|
39
|
+ * Callback to invoke when {@link OverflowMenuVideoQualityItem} is clicked.
|
|
40
|
+ */
|
|
41
|
+ onClick: Function,
|
|
42
|
+
|
|
43
|
+ /**
|
|
44
|
+ * Invoked to obtain translated strings.
|
|
45
|
+ */
|
|
46
|
+ t: Function
|
|
47
|
+};
|
|
48
|
+
|
|
49
|
+/**
|
|
50
|
+ * React {@code Component} responsible for displaying a button in the overflow
|
|
51
|
+ * menu of the toolbar, including an icon showing the currently selected
|
|
52
|
+ * max receive quality.
|
|
53
|
+ *
|
|
54
|
+ * @extends Component
|
|
55
|
+ */
|
|
56
|
+class OverflowMenuVideoQualityItem extends Component<Props> {
|
|
57
|
+ /**
|
|
58
|
+ * Implements React's {@link Component#render()}.
|
|
59
|
+ *
|
|
60
|
+ * @inheritdoc
|
|
61
|
+ * @returns {ReactElement}
|
|
62
|
+ */
|
|
63
|
+ render() {
|
|
64
|
+ const { _audioOnly, _receiveVideoQuality } = this.props;
|
|
65
|
+ const icon = _audioOnly || !_receiveVideoQuality
|
|
66
|
+ ? 'icon-AUD'
|
|
67
|
+ : VIDEO_QUALITY_TO_ICON[_receiveVideoQuality];
|
|
68
|
+
|
|
69
|
+ return (
|
|
70
|
+ <li
|
|
71
|
+ aria-label = 'Call quality'
|
|
72
|
+ className = 'overflow-menu-item'
|
|
73
|
+ onClick = { this.props.onClick }>
|
|
74
|
+ <span className = 'overflow-menu-item-icon'>
|
|
75
|
+ <i className = { icon } />
|
|
76
|
+ </span>
|
|
77
|
+ <span className = 'profile-text'>
|
|
78
|
+ { this.props.t('toolbar.callQuality') }
|
|
79
|
+ </span>
|
|
80
|
+ </li>
|
|
81
|
+ );
|
|
82
|
+ }
|
|
83
|
+}
|
|
84
|
+
|
|
85
|
+/**
|
|
86
|
+ * Maps (parts of) the Redux state to the associated props for the
|
|
87
|
+ * {@code OverflowMenuVideoQualityItem} component.
|
|
88
|
+ *
|
|
89
|
+ * @param {Object} state - The Redux state.
|
|
90
|
+ * @private
|
|
91
|
+ * @returns {{
|
|
92
|
+ * _audioOnly: boolean,
|
|
93
|
+ * _receiveVideoQuality: number
|
|
94
|
+ * }}
|
|
95
|
+ */
|
|
96
|
+function _mapStateToProps(state) {
|
|
97
|
+ return {
|
|
98
|
+ _audioOnly: state['features/base/conference'].audioOnly,
|
|
99
|
+ _receiveVideoQuality:
|
|
100
|
+ state['features/base/conference'].receiveVideoQuality
|
|
101
|
+ };
|
|
102
|
+}
|
|
103
|
+
|
|
104
|
+export default translate(
|
|
105
|
+ connect(_mapStateToProps)(OverflowMenuVideoQualityItem));
|