浏览代码

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 年前
父节点
当前提交
d24d5d95dd

+ 1
- 4
css/_videolayout_default.scss 查看文件

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

+ 5
- 1
modules/UI/videolayout/ConnectionIndicator.js 查看文件

1
 /* global $, APP, config */
1
 /* global $, APP, config */
2
 /* jshint -W101 */
2
 /* jshint -W101 */
3
+import {
4
+    setLargeVideoHDStatus
5
+} from '../../../react/features/base/conference';
6
+
3
 import JitsiPopover from "../util/JitsiPopover";
7
 import JitsiPopover from "../util/JitsiPopover";
4
 import VideoLayout from "./VideoLayout";
8
 import VideoLayout from "./VideoLayout";
5
 import UIUtil from "../util/UIUtil";
9
 import UIUtil from "../util/UIUtil";
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 查看文件

1080
         return largeVideo;
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
      * Sets the flipX state of the local video.
1084
      * Sets the flipX state of the local video.
1095
      * @param {boolean} true for flipped otherwise false;
1085
      * @param {boolean} true for flipped otherwise false;

+ 11
- 0
react/features/base/conference/actionTypes.js 查看文件

93
 export const _SET_AUDIO_ONLY_VIDEO_MUTED
93
 export const _SET_AUDIO_ONLY_VIDEO_MUTED
94
     = Symbol('_SET_AUDIO_ONLY_VIDEO_MUTED');
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
  * The type of redux action which sets the video channel's lastN (value).
108
  * The type of redux action which sets the video channel's lastN (value).
98
  *
109
  *

+ 18
- 0
react/features/base/conference/actions.js 查看文件

20
     LOCK_STATE_CHANGED,
20
     LOCK_STATE_CHANGED,
21
     SET_AUDIO_ONLY,
21
     SET_AUDIO_ONLY,
22
     _SET_AUDIO_ONLY_VIDEO_MUTED,
22
     _SET_AUDIO_ONLY_VIDEO_MUTED,
23
+    SET_LARGE_VIDEO_HD_STATUS,
23
     SET_LASTN,
24
     SET_LASTN,
24
     SET_PASSWORD,
25
     SET_PASSWORD,
25
     SET_PASSWORD_FAILED,
26
     SET_PASSWORD_FAILED,
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
  * Sets the video channel's last N (value) of the current conference. A value of
380
  * Sets the video channel's last N (value) of the current conference. A value of
363
  * undefined shall be used to reset it to the default value.
381
  * undefined shall be used to reset it to the default value.

+ 23
- 1
react/features/base/conference/reducer.js 查看文件

11
     LOCK_STATE_CHANGED,
11
     LOCK_STATE_CHANGED,
12
     SET_AUDIO_ONLY,
12
     SET_AUDIO_ONLY,
13
     _SET_AUDIO_ONLY_VIDEO_MUTED,
13
     _SET_AUDIO_ONLY_VIDEO_MUTED,
14
+    SET_LARGE_VIDEO_HD_STATUS,
14
     SET_PASSWORD,
15
     SET_PASSWORD,
15
     SET_ROOM
16
     SET_ROOM
16
 } from './actionTypes';
17
 } from './actionTypes';
43
     case _SET_AUDIO_ONLY_VIDEO_MUTED:
44
     case _SET_AUDIO_ONLY_VIDEO_MUTED:
44
         return _setAudioOnlyVideoMuted(state, action);
45
         return _setAudioOnlyVideoMuted(state, action);
45
 
46
 
47
+    case SET_LARGE_VIDEO_HD_STATUS:
48
+        return _setLargeVideoHDStatus(state, action);
49
+
46
     case SET_PASSWORD:
50
     case SET_PASSWORD:
47
         return _setPassword(state, action);
51
         return _setPassword(state, action);
48
 
52
 
238
  * reduction of the specified action.
242
  * reduction of the specified action.
239
  */
243
  */
240
 function _setAudioOnly(state, action) {
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
     return set(state, 'audioOnlyVideoMuted', action.muted);
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
  * Reduces a specific Redux action SET_PASSWORD of the feature base/conference.
282
  * Reduces a specific Redux action SET_PASSWORD of the feature base/conference.
261
  *
283
  *

+ 2
- 5
react/features/conference/components/Conference.web.js 查看文件

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

+ 0
- 58
react/features/status-label/components/StatusLabel.js 查看文件

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 查看文件

1
-export { default as StatusLabel } from './StatusLabel';

react/features/status-label/components/AudioOnlyLabel.js → react/features/video-status-label/components/AudioOnlyLabel.js 查看文件

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

+ 16
- 0
react/features/video-status-label/components/HDVideoLabel.js 查看文件

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 查看文件

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 查看文件

1
+export { default as VideoStatusLabel } from './VideoStatusLabel';

react/features/status-label/index.js → react/features/video-status-label/index.js 查看文件


正在加载...
取消
保存