Переглянути джерело

ref(filmstrip): hook filmstrip to redux for 1-on-1 mode

- Remove non-redux paths for hiding and showing remote videos.
- Hook web filmstrip to redux to know when to hide remote videos.
  This works, even though VideoLayout is handling RemoteVideo
  appending, because react is only monitoring filmstrip's declared
  JSX which does not change except for attributes (css classes).
j8
Leonard Kim 7 роки тому
джерело
коміт
27deb97c5c

+ 4
- 2
conference.js Переглянути файл

62
 import { statsEmitter } from './react/features/connection-indicator';
62
 import { statsEmitter } from './react/features/connection-indicator';
63
 import { showDesktopPicker } from  './react/features/desktop-picker';
63
 import { showDesktopPicker } from  './react/features/desktop-picker';
64
 import { maybeOpenFeedbackDialog } from './react/features/feedback';
64
 import { maybeOpenFeedbackDialog } from './react/features/feedback';
65
+import { setFilmstripRemoteVideosVisibility } from './react/features/filmstrip';
65
 import {
66
 import {
66
     mediaPermissionPromptVisibilityChanged,
67
     mediaPermissionPromptVisibilityChanged,
67
     suspendDetected
68
     suspendDetected
2176
                 || remoteVideosCount > 1
2177
                 || remoteVideosCount > 1
2177
                 || remoteParticipantsCount !== remoteVideosCount;
2178
                 || remoteParticipantsCount !== remoteVideosCount;
2178
 
2179
 
2179
-            APP.UI.setRemoteThumbnailsVisibility(
2180
-                Boolean(shouldShowRemoteThumbnails));
2180
+            APP.store.dispatch(
2181
+                setFilmstripRemoteVideosVisibility(
2182
+                    Boolean(shouldShowRemoteThumbnails)));
2181
         }
2183
         }
2182
     },
2184
     },
2183
     /**
2185
     /**

+ 0
- 14
modules/UI/UI.js Переглянути файл

290
     SideContainerToggler.init(eventEmitter);
290
     SideContainerToggler.init(eventEmitter);
291
     Filmstrip.init(eventEmitter);
291
     Filmstrip.init(eventEmitter);
292
 
292
 
293
-    // By default start with remote videos hidden and rely on other logic to
294
-    // make them visible.
295
-    UI.setRemoteThumbnailsVisibility(false);
296
-
297
     VideoLayout.init(eventEmitter);
293
     VideoLayout.init(eventEmitter);
298
     if (!interfaceConfig.filmStripOnly) {
294
     if (!interfaceConfig.filmStripOnly) {
299
         VideoLayout.initLargeVideo();
295
         VideoLayout.initLargeVideo();
1220
  */
1216
  */
1221
 UI.getRemoteVideosCount = () => VideoLayout.getRemoteVideosCount();
1217
 UI.getRemoteVideosCount = () => VideoLayout.getRemoteVideosCount();
1222
 
1218
 
1223
-/**
1224
- * Makes remote thumbnail videos visible or not visible.
1225
- *
1226
- * @param {boolean} shouldHide - True if remote thumbnails should be hidden,
1227
- * false f they should be visible.
1228
- * @returns {void}
1229
- */
1230
-UI.setRemoteThumbnailsVisibility
1231
-    = shouldHide => Filmstrip.setRemoteVideoVisibility(shouldHide);
1232
-
1233
 /**
1219
 /**
1234
  * Sets the remote control active status for a remote participant.
1220
  * Sets the remote control active status for a remote participant.
1235
  *
1221
  *

+ 2
- 25
modules/UI/videolayout/Filmstrip.js Переглянути файл

1
-/* global $, APP, config, JitsiMeetJS, interfaceConfig */
1
+/* global $, APP, JitsiMeetJS, interfaceConfig */
2
 
2
 
3
-import {
4
-    setFilmstripRemoteVideosVisibility,
5
-    setFilmstripVisibility
6
-} from '../../../react/features/filmstrip';
3
+import { setFilmstripVisibility } from '../../../react/features/filmstrip';
7
 
4
 
8
 import UIEvents from "../../../service/UI/UIEvents";
5
 import UIEvents from "../../../service/UI/UIEvents";
9
 import UIUtil from "../util/UIUtil";
6
 import UIUtil from "../util/UIUtil";
30
         }
27
         }
31
     },
28
     },
32
 
29
 
33
-    /**
34
-     * Sets a class on the remote videos container for CSS to adjust visibility
35
-     * of the remote videos. Will no-op if config.debug is truthy, as should be
36
-     * the case with torture tests.
37
-     *
38
-     * @param {boolean} shouldHide - True if remote videos should be hidden,
39
-     * false if they should be visible.
40
-     * @returns {void}
41
-     */
42
-    setRemoteVideoVisibility(shouldShow) {
43
-        // Allow disabling on 1-on-1 UI mode. Used by torture tests.
44
-        if (config.disable1On1Mode) {
45
-            return;
46
-        }
47
-
48
-        APP.store.dispatch(setFilmstripRemoteVideosVisibility(shouldShow));
49
-        $(`.${this.filmstripContainerClassName}`)
50
-            .toggleClass('hide-videos', !shouldShow);
51
-    },
52
-
53
     /**
30
     /**
54
      * Initializes the filmstrip toolbar.
31
      * Initializes the filmstrip toolbar.
55
      */
32
      */

+ 42
- 3
react/features/filmstrip/components/Filmstrip.web.js Переглянути файл

1
 /* @flow */
1
 /* @flow */
2
 
2
 
3
 import React, { Component } from 'react';
3
 import React, { Component } from 'react';
4
+import { connect } from 'react-redux';
4
 
5
 
5
 import { Toolbox } from '../../toolbox';
6
 import { Toolbox } from '../../toolbox';
6
 
7
 
10
  *
11
  *
11
  * @extends Component
12
  * @extends Component
12
  */
13
  */
13
-export default class Filmstrip extends Component {
14
+class Filmstrip extends Component {
14
     static propTypes = {
15
     static propTypes = {
16
+        /**
17
+         * Whether or not the remote videos should be visible. Will toggle
18
+         * a class for hiding the videos.
19
+         */
20
+        _remoteVideosVisible: React.PropTypes.bool,
21
+
15
         /**
22
         /**
16
          * Whether or not the toolbox should be displayed within the filmstrip.
23
          * Whether or not the toolbox should be displayed within the filmstrip.
17
          */
24
          */
25
      * @returns {ReactElement}
32
      * @returns {ReactElement}
26
      */
33
      */
27
     render() {
34
     render() {
35
+        /**
36
+         * Note: Appending of {@code RemoteVideo} views is handled through
37
+         * VideoLayout. The views do not get blown away on render() because
38
+         * ReactDOMComponent is only aware of the given JSX and not new appended
39
+         * DOM. As such, when updateDOMProperties gets called, only attributes
40
+         * will get updated without replacing the DOM. If the known DOM gets
41
+         * modified, then the views will get blown away.
42
+         */
43
+
44
+        const filmstripClassNames = `filmstrip ${this.props._remoteVideosVisible
45
+            ? '' : 'hide-videos'}`;
46
+
28
         return (
47
         return (
29
-            <div className = 'filmstrip'>
48
+            <div className = { filmstripClassNames }>
30
                 { this.props.displayToolbox ? <Toolbox /> : null }
49
                 { this.props.displayToolbox ? <Toolbox /> : null }
31
                 <div
50
                 <div
32
                     className = 'filmstrip__videos'
51
                     className = 'filmstrip__videos'
53
                     <div
72
                     <div
54
                         className = 'filmstrip__videos'
73
                         className = 'filmstrip__videos'
55
                         id = 'filmstripRemoteVideos'>
74
                         id = 'filmstripRemoteVideos'>
56
-                        {/*
75
+                        {/**
57
                           * This extra video container is needed for scrolling
76
                           * This extra video container is needed for scrolling
58
                           * thumbnails in Firefox; otherwise, the flex
77
                           * thumbnails in Firefox; otherwise, the flex
59
                           * thumbnails resize instead of causing overflow.
78
                           * thumbnails resize instead of causing overflow.
75
         );
94
         );
76
     }
95
     }
77
 }
96
 }
97
+
98
+/**
99
+ * Maps (parts of) the Redux state to the associated {@code Filmstrip}'s props.
100
+ *
101
+ * @param {Object} state - The Redux state.
102
+ * @private
103
+ * @returns {{
104
+ *     _remoteVideosVisible: boolean
105
+ * }}
106
+ */
107
+function _mapStateToProps(state) {
108
+    const { remoteVideosVisible } = state['features/filmstrip'];
109
+    const { disable1On1Mode } = state['features/base/config'];
110
+
111
+    return {
112
+        _remoteVideosVisible: Boolean(remoteVideosVisible || disable1On1Mode)
113
+    };
114
+}
115
+
116
+export default connect(_mapStateToProps)(Filmstrip);

+ 6
- 1
react/features/filmstrip/reducer.js Переглянути файл

5
 } from './actionTypes';
5
 } from './actionTypes';
6
 
6
 
7
 const DEFAULT_STATE = {
7
 const DEFAULT_STATE = {
8
-    remoteVideosVisible: true,
8
+    /**
9
+     * By default start with remote videos hidden for 1-on-1 mode and rely on
10
+     * other logic to invoke an action to make them visible when needed.
11
+     */
12
+    remoteVideosVisible: false,
13
+
9
     visible: true
14
     visible: true
10
 };
15
 };
11
 
16
 

+ 2
- 1
react/features/video-quality/components/VideoQualityLabel.web.js Переглянути файл

252
         audioOnly,
252
         audioOnly,
253
         conference
253
         conference
254
     } = state['features/base/conference'];
254
     } = state['features/base/conference'];
255
+    const { disable1On1Mode } = state['features/base/config'];
255
     const {
256
     const {
256
         remoteVideosVisible,
257
         remoteVideosVisible,
257
         visible
258
         visible
264
         _audioOnly: audioOnly,
265
         _audioOnly: audioOnly,
265
         _conferenceStarted: Boolean(conference),
266
         _conferenceStarted: Boolean(conference),
266
         _filmstripVisible: visible,
267
         _filmstripVisible: visible,
267
-        _remoteVideosVisible: remoteVideosVisible,
268
+        _remoteVideosVisible: Boolean(remoteVideosVisible || disable1On1Mode),
268
         _resolution: resolution
269
         _resolution: resolution
269
     };
270
     };
270
 }
271
 }

Завантаження…
Відмінити
Зберегти