Browse Source

fix(audio-only): combine video status labels

Move the HD label into the newly renamed VideoStatusLabel
component. That way it cannot be possible for the audio only
label and the HD label to display simultaneously.
j8
Leonard Kim 8 years ago
parent
commit
d24d5d95dd

+ 1
- 4
css/_videolayout_default.scss View File

@@ -517,19 +517,16 @@
517 517
     position: absolute;
518 518
     box-sizing: border-box;
519 519
 }
520
-.video-state-indicator {
521
-    height: 40px;
522
-}
523 520
 
524 521
 #videoResolutionLabel,
525 522
 .centeredVideoLabel {
526
-    display: none;
527 523
     z-index: $centeredVideoLabelZ;
528 524
 }
529 525
 
530 526
 .centeredVideoLabel {
531 527
     bottom: 45%;
532 528
     border-radius: 2px;
529
+    display: none;
533 530
     -webkit-transition: all 2s 2s linear;
534 531
     transition: all 2s 2s linear;
535 532
 

+ 5
- 1
modules/UI/videolayout/ConnectionIndicator.js View File

@@ -1,5 +1,9 @@
1 1
 /* global $, APP, config */
2 2
 /* jshint -W101 */
3
+import {
4
+    setLargeVideoHDStatus
5
+} from '../../../react/features/base/conference';
6
+
3 7
 import JitsiPopover from "../util/JitsiPopover";
4 8
 import VideoLayout from "./VideoLayout";
5 9
 import UIUtil from "../util/UIUtil";
@@ -478,7 +482,7 @@ ConnectionIndicator.prototype.updateResolutionIndicator = function () {
478 482
                 });
479 483
         }
480 484
 
481
-        VideoLayout.updateResolutionLabel(showResolutionLabel);
485
+        APP.store.dispatch(setLargeVideoHDStatus(showResolutionLabel));
482 486
     }
483 487
 };
484 488
 

+ 0
- 10
modules/UI/videolayout/VideoLayout.js View File

@@ -1080,16 +1080,6 @@ var VideoLayout = {
1080 1080
         return largeVideo;
1081 1081
     },
1082 1082
 
1083
-    /**
1084
-     * Updates the resolution label, indicating to the user that the large
1085
-     * video stream is currently HD.
1086
-     */
1087
-    updateResolutionLabel(isResolutionHD) {
1088
-        let id = 'videoResolutionLabel';
1089
-
1090
-        UIUtil.setVisible(id, isResolutionHD);
1091
-    },
1092
-
1093 1083
     /**
1094 1084
      * Sets the flipX state of the local video.
1095 1085
      * @param {boolean} true for flipped otherwise false;

+ 11
- 0
react/features/base/conference/actionTypes.js View File

@@ -93,6 +93,17 @@ export const SET_AUDIO_ONLY = Symbol('SET_AUDIO_ONLY');
93 93
 export const _SET_AUDIO_ONLY_VIDEO_MUTED
94 94
     = Symbol('_SET_AUDIO_ONLY_VIDEO_MUTED');
95 95
 
96
+/**
97
+ * The type of (redux) action to set whether or not the displayed large video is
98
+ * in high-definition.
99
+ *
100
+ * {
101
+ *     type: SET_LARGE_VIDEO_HD_STATUS,
102
+ *     isLargeVideoHD: boolean
103
+ * }
104
+ */
105
+export const SET_LARGE_VIDEO_HD_STATUS = Symbol('SET_LARGE_VIDEO_HD_STATUS');
106
+
96 107
 /**
97 108
  * The type of redux action which sets the video channel's lastN (value).
98 109
  *

+ 18
- 0
react/features/base/conference/actions.js View File

@@ -20,6 +20,7 @@ import {
20 20
     LOCK_STATE_CHANGED,
21 21
     SET_AUDIO_ONLY,
22 22
     _SET_AUDIO_ONLY_VIDEO_MUTED,
23
+    SET_LARGE_VIDEO_HD_STATUS,
23 24
     SET_LASTN,
24 25
     SET_PASSWORD,
25 26
     SET_PASSWORD_FAILED,
@@ -358,6 +359,23 @@ export function _setAudioOnlyVideoMuted(muted: boolean) {
358 359
     };
359 360
 }
360 361
 
362
+/**
363
+ * Action to set whether or not the currently displayed large video is in
364
+ * high-definition.
365
+ *
366
+ * @param {boolean} isLargeVideoHD - True if the large video is high-definition.
367
+ * @returns {{
368
+ *     type: SET_LARGE_VIDEO_HD_STATUS,
369
+ *     isLargeVideoHD: boolean
370
+ * }}
371
+ */
372
+export function setLargeVideoHDStatus(isLargeVideoHD) {
373
+    return {
374
+        type: SET_LARGE_VIDEO_HD_STATUS,
375
+        isLargeVideoHD
376
+    };
377
+}
378
+
361 379
 /**
362 380
  * Sets the video channel's last N (value) of the current conference. A value of
363 381
  * undefined shall be used to reset it to the default value.

+ 23
- 1
react/features/base/conference/reducer.js View File

@@ -11,6 +11,7 @@ import {
11 11
     LOCK_STATE_CHANGED,
12 12
     SET_AUDIO_ONLY,
13 13
     _SET_AUDIO_ONLY_VIDEO_MUTED,
14
+    SET_LARGE_VIDEO_HD_STATUS,
14 15
     SET_PASSWORD,
15 16
     SET_ROOM
16 17
 } from './actionTypes';
@@ -43,6 +44,9 @@ ReducerRegistry.register('features/base/conference', (state = {}, action) => {
43 44
     case _SET_AUDIO_ONLY_VIDEO_MUTED:
44 45
         return _setAudioOnlyVideoMuted(state, action);
45 46
 
47
+    case SET_LARGE_VIDEO_HD_STATUS:
48
+        return _setLargeVideoHDStatus(state, action);
49
+
46 50
     case SET_PASSWORD:
47 51
         return _setPassword(state, action);
48 52
 
@@ -238,7 +242,10 @@ function _lockStateChanged(state, action) {
238 242
  * reduction of the specified action.
239 243
  */
240 244
 function _setAudioOnly(state, action) {
241
-    return set(state, 'audioOnly', action.audioOnly);
245
+    return assign(state, {
246
+        audioOnly: action.audioOnly,
247
+        isLargeVideoHD: action.audioOnly ? false : state.isLargeVideoHD
248
+    });
242 249
 }
243 250
 
244 251
 /**
@@ -256,6 +263,21 @@ function _setAudioOnlyVideoMuted(state, action) {
256 263
     return set(state, 'audioOnlyVideoMuted', action.muted);
257 264
 }
258 265
 
266
+/**
267
+ * Reduces a specific Redux action SET_LARGE_VIDEO_HD_STATUS of the feature
268
+ * base/conference.
269
+ *
270
+ * @param {Object} state - The Redux state of the feature base/conference.
271
+ * @param {Action} action - The Redux action SET_LARGE_VIDEO_HD_STATUS to
272
+ * reduce.
273
+ * @private
274
+ * @returns {Object} The new state of the feature base/conference after the
275
+ * reduction of the specified action.
276
+ */
277
+function _setLargeVideoHDStatus(state, action) {
278
+    return set(state, 'isLargeVideoHD', action.isLargeVideoHD);
279
+}
280
+
259 281
 /**
260 282
  * Reduces a specific Redux action SET_PASSWORD of the feature base/conference.
261 283
  *

+ 2
- 5
react/features/conference/components/Conference.web.js View File

@@ -7,9 +7,9 @@ import { connect, disconnect } from '../../base/connection';
7 7
 import { DialogContainer } from '../../base/dialog';
8 8
 import { Watermarks } from '../../base/react';
9 9
 import { OverlayContainer } from '../../overlay';
10
-import { StatusLabel } from '../../status-label';
11 10
 import { Toolbox } from '../../toolbox';
12 11
 import { HideNotificationBarStyle } from '../../unsupported-browser';
12
+import { VideoStatusLabel } from '../../video-status-label';
13 13
 
14 14
 declare var $: Function;
15 15
 declare var APP: Object;
@@ -93,10 +93,7 @@ class Conference extends Component {
93 93
                                 muted = 'true' />
94 94
                         </div>
95 95
                         <span id = 'localConnectionMessage' />
96
-                        <span
97
-                            className = 'video-state-indicator moveToCorner'
98
-                            id = 'videoResolutionLabel'>HD</span>
99
-                        <StatusLabel />
96
+                        <VideoStatusLabel />
100 97
                         <span
101 98
                             className
102 99
                                 = 'video-state-indicator centeredVideoLabel'

+ 0
- 58
react/features/status-label/components/StatusLabel.js View File

@@ -1,58 +0,0 @@
1
-import React, { Component } from 'react';
2
-import { connect } from 'react-redux';
3
-
4
-import AudioOnlyLabel from './AudioOnlyLabel';
5
-
6
-/**
7
- * Component responsible for displaying a label that indicates some state of the
8
- * current conference. The AudioOnlyLabel component will be displayed when the
9
- * conference is in audio only mode.
10
- */
11
-export class StatusLabel extends Component {
12
-    /**
13
-     * StatusLabel component's property types.
14
-     *
15
-     * @static
16
-     */
17
-    static propTypes = {
18
-        /**
19
-         * The redux store representation of the current conference.
20
-         */
21
-        _conference: React.PropTypes.object
22
-    }
23
-
24
-    /**
25
-     * Implements React's {@link Component#render()}.
26
-     *
27
-     * @inheritdoc
28
-     * @returns {ReactElement|null}
29
-     */
30
-    render() {
31
-        if (!this.props._conference.audioOnly) {
32
-            return null;
33
-        }
34
-
35
-        return (
36
-            <div className = 'moveToCorner'>
37
-                <AudioOnlyLabel />
38
-            </div>
39
-        );
40
-    }
41
-}
42
-
43
-/**
44
- * Maps (parts of) the Redux state to the associated StatusLabel's props.
45
- *
46
- * @param {Object} state - The Redux state.
47
- * @private
48
- * @returns {{
49
- *     _conference: Object,
50
- * }}
51
- */
52
-function _mapStateToProps(state) {
53
-    return {
54
-        _conference: state['features/base/conference']
55
-    };
56
-}
57
-
58
-export default connect(_mapStateToProps)(StatusLabel);

+ 0
- 1
react/features/status-label/components/index.js View File

@@ -1 +0,0 @@
1
-export { default as StatusLabel } from './StatusLabel';

react/features/status-label/components/AudioOnlyLabel.js → react/features/video-status-label/components/AudioOnlyLabel.js View File

@@ -66,7 +66,7 @@ export class AudioOnlyLabel extends Component {
66 66
     render() {
67 67
         return (
68 68
             <div
69
-                className = 'audio-only-label'
69
+                className = 'audio-only-label moveToCorner'
70 70
                 ref = { this._setRootElement }>
71 71
                 <i className = 'icon-visibility-off' />
72 72
             </div>

+ 16
- 0
react/features/video-status-label/components/HDVideoLabel.js View File

@@ -0,0 +1,16 @@
1
+import React from 'react';
2
+
3
+/**
4
+ * A functional React {@code Component} for showing an HD status label.
5
+ *
6
+ * @returns {ReactElement}
7
+ */
8
+export default function HDVideoLabel() {
9
+    return (
10
+        <span
11
+            className = 'video-state-indicator moveToCorner'
12
+            id = 'videoResolutionLabel'>
13
+            HD
14
+        </span>
15
+    );
16
+}

+ 69
- 0
react/features/video-status-label/components/VideoStatusLabel.js View File

@@ -0,0 +1,69 @@
1
+import React, { Component } from 'react';
2
+import { connect } from 'react-redux';
3
+
4
+import AudioOnlyLabel from './AudioOnlyLabel';
5
+import HDVideoLabel from './HDVideoLabel';
6
+
7
+/**
8
+ * React {@code Component} responsible for displaying a label that indicates
9
+ * the displayed video state of the current conference. {@code AudioOnlyLabel}
10
+ * will display when the conference is in audio only mode. {@code HDVideoLabel}
11
+ * will display if not in audio only mode and a high-definition large video is
12
+ * being displayed.
13
+ */
14
+export class VideoStatusLabel extends Component {
15
+    /**
16
+     * {@code VideoStatusLabel}'s property types.
17
+     *
18
+     * @static
19
+     */
20
+    static propTypes = {
21
+        /**
22
+         * Whether or not the conference is in audio only mode.
23
+         */
24
+        _audioOnly: React.PropTypes.bool,
25
+
26
+        /**
27
+         * Whether or not a high-definition large video is displayed.
28
+         */
29
+        _largeVideoHD: React.PropTypes.bool
30
+    }
31
+
32
+    /**
33
+     * Implements React's {@link Component#render()}.
34
+     *
35
+     * @inheritdoc
36
+     * @returns {ReactElement|null}
37
+     */
38
+    render() {
39
+        if (this.props._audioOnly) {
40
+            return <AudioOnlyLabel />;
41
+        } else if (this.props._largeVideoHD) {
42
+            return <HDVideoLabel />;
43
+        }
44
+
45
+        return null;
46
+    }
47
+}
48
+
49
+/**
50
+ * Maps (parts of) the Redux state to the associated {@code VideoStatusLabel}'s
51
+ * props.
52
+ *
53
+ * @param {Object} state - The Redux state.
54
+ * @private
55
+ * @returns {{
56
+ *     _audioOnly: boolean,
57
+ *     _largeVideoHD: boolean
58
+ * }}
59
+ */
60
+function _mapStateToProps(state) {
61
+    const { audioOnly, isLargeVideoHD } = state['features/base/conference'];
62
+
63
+    return {
64
+        _audioOnly: audioOnly,
65
+        _largeVideoHD: isLargeVideoHD
66
+    };
67
+}
68
+
69
+export default connect(_mapStateToProps)(VideoStatusLabel);

+ 1
- 0
react/features/video-status-label/components/index.js View File

@@ -0,0 +1 @@
1
+export { default as VideoStatusLabel } from './VideoStatusLabel';

react/features/status-label/index.js → react/features/video-status-label/index.js View File


Loading…
Cancel
Save