Bladeren bron

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 jaren geleden
bovenliggende
commit
27deb97c5c

+ 4
- 2
conference.js Bestand weergeven

@@ -62,6 +62,7 @@ import { getLocationContextRoot } from './react/features/base/util';
62 62
 import { statsEmitter } from './react/features/connection-indicator';
63 63
 import { showDesktopPicker } from  './react/features/desktop-picker';
64 64
 import { maybeOpenFeedbackDialog } from './react/features/feedback';
65
+import { setFilmstripRemoteVideosVisibility } from './react/features/filmstrip';
65 66
 import {
66 67
     mediaPermissionPromptVisibilityChanged,
67 68
     suspendDetected
@@ -2176,8 +2177,9 @@ export default {
2176 2177
                 || remoteVideosCount > 1
2177 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 Bestand weergeven

@@ -290,10 +290,6 @@ UI.start = function () {
290 290
     SideContainerToggler.init(eventEmitter);
291 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 293
     VideoLayout.init(eventEmitter);
298 294
     if (!interfaceConfig.filmStripOnly) {
299 295
         VideoLayout.initLargeVideo();
@@ -1220,16 +1216,6 @@ UI.onUserFeaturesChanged = user => VideoLayout.onUserFeaturesChanged(user);
1220 1216
  */
1221 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 1220
  * Sets the remote control active status for a remote participant.
1235 1221
  *

+ 2
- 25
modules/UI/videolayout/Filmstrip.js Bestand weergeven

@@ -1,9 +1,6 @@
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 5
 import UIEvents from "../../../service/UI/UIEvents";
9 6
 import UIUtil from "../util/UIUtil";
@@ -30,26 +27,6 @@ const Filmstrip = {
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 31
      * Initializes the filmstrip toolbar.
55 32
      */

+ 42
- 3
react/features/filmstrip/components/Filmstrip.web.js Bestand weergeven

@@ -1,6 +1,7 @@
1 1
 /* @flow */
2 2
 
3 3
 import React, { Component } from 'react';
4
+import { connect } from 'react-redux';
4 5
 
5 6
 import { Toolbox } from '../../toolbox';
6 7
 
@@ -10,8 +11,14 @@ import { Toolbox } from '../../toolbox';
10 11
  *
11 12
  * @extends Component
12 13
  */
13
-export default class Filmstrip extends Component {
14
+class Filmstrip extends Component {
14 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 23
          * Whether or not the toolbox should be displayed within the filmstrip.
17 24
          */
@@ -25,8 +32,20 @@ export default class Filmstrip extends Component {
25 32
      * @returns {ReactElement}
26 33
      */
27 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 47
         return (
29
-            <div className = 'filmstrip'>
48
+            <div className = { filmstripClassNames }>
30 49
                 { this.props.displayToolbox ? <Toolbox /> : null }
31 50
                 <div
32 51
                     className = 'filmstrip__videos'
@@ -53,7 +72,7 @@ export default class Filmstrip extends Component {
53 72
                     <div
54 73
                         className = 'filmstrip__videos'
55 74
                         id = 'filmstripRemoteVideos'>
56
-                        {/*
75
+                        {/**
57 76
                           * This extra video container is needed for scrolling
58 77
                           * thumbnails in Firefox; otherwise, the flex
59 78
                           * thumbnails resize instead of causing overflow.
@@ -75,3 +94,23 @@ export default class Filmstrip extends Component {
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 Bestand weergeven

@@ -5,7 +5,12 @@ import {
5 5
 } from './actionTypes';
6 6
 
7 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 14
     visible: true
10 15
 };
11 16
 

+ 2
- 1
react/features/video-quality/components/VideoQualityLabel.web.js Bestand weergeven

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

Laden…
Annuleren
Opslaan