Explorar el Código

feat(config) add connection indicators flags

master
Tudor D. Pop hace 3 años
padre
commit
d95d52843f
No account linked to committer's email address

+ 8
- 0
config.js Ver fichero

@@ -253,6 +253,14 @@ var config = {
253 253
     // Default value for the channel "last N" attribute. -1 for unlimited.
254 254
     channelLastN: -1,
255 255
 
256
+    // Connection indicators
257
+    // connectionIndicators: {
258
+    //     autoHide: true,
259
+    //     autoHideTimeout: 5000,
260
+    //     disabled: false,
261
+    //     inactiveDisabled: false
262
+    // },
263
+
256 264
     // Provides a way for the lastN value to be controlled through the UI.
257 265
     // When startLastN is present, conference starts with a last-n value of startLastN and channelLastN
258 266
     // value will be used when the quality level is selected using "Manage Video Quality" slider.

+ 8
- 28
interface_config.js Ver fichero

@@ -25,31 +25,11 @@ var interfaceConfig = {
25 25
     BRAND_WATERMARK_LINK: '',
26 26
 
27 27
     CLOSE_PAGE_GUEST_HINT: false, // A html text to be shown to guests on the close page, false disables it
28
-    /**
29
-     * Whether the connection indicator icon should hide itself based on
30
-     * connection strength. If true, the connection indicator will remain
31
-     * displayed while the participant has a weak connection and will hide
32
-     * itself after the CONNECTION_INDICATOR_HIDE_TIMEOUT when the connection is
33
-     * strong.
34
-     *
35
-     * @type {boolean}
36
-     */
37
-    CONNECTION_INDICATOR_AUTO_HIDE_ENABLED: true,
38 28
 
39
-    /**
40
-     * How long the connection indicator should remain displayed before hiding.
41
-     * Used in conjunction with CONNECTION_INDICATOR_AUTOHIDE_ENABLED.
42
-     *
43
-     * @type {number}
44
-     */
45
-    CONNECTION_INDICATOR_AUTO_HIDE_TIMEOUT: 5000,
46
-
47
-    /**
48
-     * If true, hides the connection indicators completely.
49
-     *
50
-     * @type {boolean}
51
-     */
52
-    CONNECTION_INDICATOR_DISABLED: false,
29
+    // Connection indicators (
30
+    // CONNECTION_INDICATOR_AUTO_HIDE_ENABLED,
31
+    // CONNECTION_INDICATOR_AUTO_HIDE_TIMEOUT,
32
+    // CONNECTION_INDICATOR_DISABLED) got moved to config.js.
53 33
 
54 34
     DEFAULT_BACKGROUND: '#474747',
55 35
     DEFAULT_LOCAL_DISPLAY_NAME: 'me',
@@ -185,10 +165,10 @@ var interfaceConfig = {
185 165
     SHOW_BRAND_WATERMARK: false,
186 166
 
187 167
     /**
188
-    * Decides whether the chrome extension banner should be rendered on the landing page and during the meeting.
189
-    * If this is set to false, the banner will not be rendered at all. If set to true, the check for extension(s)
190
-    * being already installed is done before rendering.
191
-    */
168
+     * Decides whether the chrome extension banner should be rendered on the landing page and during the meeting.
169
+     * If this is set to false, the banner will not be rendered at all. If set to true, the check for extension(s)
170
+     * being already installed is done before rendering.
171
+     */
192 172
     SHOW_CHROME_EXTENSION_BANNER: false,
193 173
 
194 174
     SHOW_DEEP_LINKING_IMAGE: false,

+ 1
- 0
react/features/base/config/configWhitelist.js Ver fichero

@@ -70,6 +70,7 @@ export default [
70 70
     'callUUID',
71 71
 
72 72
     'channelLastN',
73
+    'connectionIndicators',
73 74
     'constraints',
74 75
     'brandingRoomAlias',
75 76
     'debug',

+ 12
- 0
react/features/base/config/reducer.js Ver fichero

@@ -194,6 +194,18 @@ function _translateLegacyConfig(oldValue: Object) {
194 194
         newValue.toolbarButtons = interfaceConfig.TOOLBAR_BUTTONS;
195 195
     }
196 196
 
197
+    if (!oldValue.connectionIndicators
198
+            && typeof interfaceConfig === 'object'
199
+            && (interfaceConfig.hasOwnProperty('CONNECTION_INDICATOR_DISABLED')
200
+                || interfaceConfig.hasOwnProperty('CONNECTION_INDICATOR_AUTO_HIDE_ENABLED')
201
+                || interfaceConfig.hasOwnProperty('CONNECTION_INDICATOR_AUTO_HIDE_TIMEOUT'))) {
202
+        newValue.connectionIndicators = {
203
+            disabled: interfaceConfig.CONNECTION_INDICATOR_DISABLED,
204
+            autoHide: interfaceConfig.CONNECTION_INDICATOR_AUTO_HIDE_ENABLED,
205
+            autoHideTimeout: interfaceConfig.CONNECTION_INDICATOR_AUTO_HIDE_TIMEOUT
206
+        };
207
+    }
208
+
197 209
     if (oldValue.stereo || oldValue.opusMaxAverageBitrate) {
198 210
         newValue.audioQuality = {
199 211
             opusMaxAverageBitrate: oldValue.audioQuality?.opusMaxAverageBitrate ?? oldValue.opusMaxAverageBitrate,

+ 25
- 4
react/features/connection-indicator/components/AbstractConnectionIndicator.js Ver fichero

@@ -6,6 +6,8 @@ import statsEmitter from '../statsEmitter';
6 6
 
7 7
 declare var interfaceConfig: Object;
8 8
 
9
+const defaultAutoHideTimeout = 5000;
10
+
9 11
 /**
10 12
  * The connection quality percentage that must be reached to be considered of
11 13
  * good quality and can result in the connection indicator being hidden.
@@ -19,6 +21,11 @@ export const INDICATOR_DISPLAY_THRESHOLD = 30;
19 21
  */
20 22
 export type Props = {
21 23
 
24
+    /**
25
+     * How long the connection indicator should remain displayed before hiding.
26
+     */
27
+    _autoHideTimeout: number,
28
+
22 29
     /**
23 30
      * The ID of the participant associated with the displayed connection indication and
24 31
      * stats.
@@ -52,7 +59,7 @@ export type State = {
52 59
  *
53 60
  * @extends {Component}
54 61
  */
55
-export default class AbstractConnectionIndicator<P: Props, S: State> extends Component<P, S> {
62
+class AbstractConnectionIndicator<P: Props, S: State> extends Component<P, S> {
56 63
     /**
57 64
      * The timeout for automatically hiding the indicator.
58 65
      */
@@ -165,9 +172,23 @@ export default class AbstractConnectionIndicator<P: Props, S: State> extends Com
165 172
                 this.setState({
166 173
                     showIndicator: false
167 174
                 });
168
-            }, typeof interfaceConfig === 'undefined'
169
-                ? 5000
170
-                : interfaceConfig.CONNECTION_INDICATOR_AUTO_HIDE_TIMEOUT);
175
+            }, this.props._autoHideTimeout);
171 176
         }
172 177
     }
173 178
 }
179
+
180
+/**
181
+ * Maps (parts of) the Redux state to the associated props for the
182
+ * {@code ConnectorIndicator} component.
183
+ *
184
+ * @param {Object} state - The Redux state.
185
+ * @private
186
+ * @returns {Props}
187
+ */
188
+export function mapStateToProps(state: Object) {
189
+    return {
190
+        _autoHideTimeout: state['features/base/config'].connectionIndicators.autoHideTimeout ?? defaultAutoHideTimeout
191
+    };
192
+}
193
+
194
+export default AbstractConnectionIndicator;

+ 12
- 2
react/features/connection-indicator/components/web/ConnectionIndicator.js Ver fichero

@@ -64,6 +64,11 @@ type Props = AbstractProps & {
64 64
      */
65 65
     _connectionStatus: string,
66 66
 
67
+    /**
68
+     * Disable/enable inactive indicator.
69
+     */
70
+    _connectionIndicatorInactiveDisabled: boolean,
71
+
67 72
     /**
68 73
      * Whether or not the component should ignore setting a visibility class for
69 74
      * hiding the component when the connection quality is not strong.
@@ -224,8 +229,11 @@ class ConnectionIndicator extends AbstractConnectionIndicator<Props, AbstractSta
224 229
      * @returns {ReactElement}
225 230
      */
226 231
     _renderIcon() {
227
-        if (this.props._connectionStatus
228
-            === JitsiParticipantConnectionStatus.INACTIVE) {
232
+        if (this.props._connectionStatus === JitsiParticipantConnectionStatus.INACTIVE) {
233
+            if (this.props._connectionIndicatorInactiveDisabled) {
234
+                return null;
235
+            }
236
+
229 237
             return (
230 238
                 <span className = 'connection_ninja'>
231 239
                     <Icon
@@ -289,6 +297,8 @@ export function _mapStateToProps(state: Object, ownProps: Props) {
289 297
         = participantId ? getParticipantById(state, participantId) : getLocalParticipant(state);
290 298
 
291 299
     return {
300
+        _connectionIndicatorInactiveDisabled:
301
+        Boolean(state['features/base/config'].connectionIndicators?.inactiveDisabled),
292 302
         _connectionStatus: participant?.connectionStatus
293 303
     };
294 304
 }

+ 4
- 2
react/features/filmstrip/components/web/Thumbnail.js Ver fichero

@@ -1093,8 +1093,10 @@ function _mapStateToProps(state, ownProps): Object {
1093 1093
 
1094 1094
     return {
1095 1095
         _audioTrack,
1096
-        _connectionIndicatorAutoHideEnabled: interfaceConfig.CONNECTION_INDICATOR_AUTO_HIDE_ENABLED,
1097
-        _connectionIndicatorDisabled: _isMobile || interfaceConfig.CONNECTION_INDICATOR_DISABLED,
1096
+        _connectionIndicatorAutoHideEnabled:
1097
+        Boolean(state['features/base/config'].connectionIndicators?.autoHide ?? true),
1098
+        _connectionIndicatorDisabled: _isMobile
1099
+            || Boolean(state['features/base/config'].connectionIndicators?.disabled),
1098 1100
         _currentLayout,
1099 1101
         _defaultLocalDisplayName: interfaceConfig.DEFAULT_LOCAL_DISPLAY_NAME,
1100 1102
         _disableLocalVideoFlip: Boolean(disableLocalVideoFlip),

Loading…
Cancelar
Guardar