Przeglądaj źródła

[RN] Add display name label to tile view

master
Bettenbuk Zoltan 6 lat temu
rodzic
commit
e5caca9cfd

+ 13
- 2
react/features/conference/components/native/Conference.js Wyświetl plik

@@ -17,7 +17,7 @@ import { TestConnectionInfo } from '../../../base/testing';
17 17
 import { createDesiredLocalTracks } from '../../../base/tracks';
18 18
 import { ConferenceNotification } from '../../../calendar-sync';
19 19
 import { Chat } from '../../../chat';
20
-import { DisplayNameLabel } from '../../../display-name/components/native';
20
+import { DisplayNameLabel } from '../../../display-name';
21 21
 import {
22 22
     FILMSTRIP_SIZE,
23 23
     Filmstrip,
@@ -61,6 +61,11 @@ type Props = AbstractProps & {
61 61
      */
62 62
     _filmstripVisible: boolean,
63 63
 
64
+    /**
65
+     * The ID of the participant currently on stage (if any)
66
+     */
67
+    _largeVideoParticipantId: string,
68
+
64 69
     /**
65 70
      * Current conference's full URL.
66 71
      *
@@ -236,6 +241,7 @@ class Conference extends AbstractConference<Props, *> {
236 241
     render() {
237 242
         const {
238 243
             _connecting,
244
+            _largeVideoParticipantId,
239 245
             _reducedUI,
240 246
             _shouldDisplayTileView
241 247
         } = this.props;
@@ -282,7 +288,7 @@ class Conference extends AbstractConference<Props, *> {
282 288
 
283 289
                     <Captions onPress = { this._onClick } />
284 290
 
285
-                    <DisplayNameLabel />
291
+                    { _shouldDisplayTileView || <DisplayNameLabel participantId = { _largeVideoParticipantId } /> }
286 292
 
287 293
                     {/*
288 294
                       * The Toolbox is in a stacking layer bellow the Filmstrip.
@@ -497,6 +503,11 @@ function _mapStateToProps(state) {
497 503
          */
498 504
         _filmstripVisible: isFilmstripVisible(state),
499 505
 
506
+        /**
507
+         * The ID of the participant currently on stage.
508
+         */
509
+        _largeVideoParticipantId: state['features/large-video'].participantId,
510
+
500 511
         /**
501 512
          * Current conference's full URL.
502 513
          *

+ 2
- 0
react/features/conference/index.js Wyświetl plik

@@ -1,3 +1,5 @@
1
+// @flow
2
+
1 3
 export * from './components';
2 4
 
3 5
 import './middleware';

+ 15
- 10
react/features/display-name/components/native/DisplayNameLabel.js Wyświetl plik

@@ -9,7 +9,6 @@ import {
9 9
     shouldRenderParticipantVideo
10 10
 } from '../../../base/participants';
11 11
 import { connect } from '../../../base/redux';
12
-import { shouldDisplayTileView } from '../../../video-layout';
13 12
 
14 13
 import styles from './styles';
15 14
 
@@ -23,7 +22,12 @@ type Props = {
23 22
     /**
24 23
      * True of the label needs to be rendered. False otherwise.
25 24
      */
26
-    _render: boolean
25
+    _render: boolean,
26
+
27
+    /**
28
+     * The ID of the participant to render the label for.
29
+     */
30
+    participantId: string
27 31
 }
28 32
 
29 33
 /**
@@ -54,23 +58,24 @@ class DisplayNameLabel extends Component<Props> {
54 58
  * Maps part of the Redux state to the props of this component.
55 59
  *
56 60
  * @param {Object} state - The Redux state.
61
+ * @param {Props} ownProps - The own props of the component.
57 62
  * @returns {{
58 63
  * }}
59 64
  */
60
-function _mapStateToProps(state: Object) {
61
-    const largeVideoParticipantId = state['features/large-video'].participantId;
65
+function _mapStateToProps(state: Object, ownProps: Props) {
66
+    const { participantId } = ownProps;
62 67
     const localParticipant = getLocalParticipant(state);
63 68
 
64 69
     // Currently we only render the display name if it's not the local
65
-    // participant, we're not in tile view and there is no video rendered for
66
-    // the on-stage participant.
67
-    const _render = localParticipant.id !== largeVideoParticipantId
68
-        && !shouldDisplayTileView(state)
69
-        && !shouldRenderParticipantVideo(state, largeVideoParticipantId);
70
+    // participant and there is no video rendered for
71
+    // them.
72
+    const _render = Boolean(participantId)
73
+        && localParticipant.id !== participantId
74
+        && !shouldRenderParticipantVideo(state, participantId);
70 75
 
71 76
     return {
72 77
         _participantName:
73
-            getParticipantDisplayName(state, largeVideoParticipantId),
78
+            getParticipantDisplayName(state, participantId),
74 79
         _render
75 80
     };
76 81
 }

+ 0
- 0
react/features/display-name/components/web/DisplayNameLabel.js Wyświetl plik


+ 1
- 0
react/features/display-name/components/web/index.js Wyświetl plik

@@ -1,4 +1,5 @@
1 1
 // @flow
2 2
 
3 3
 export { default as DisplayName } from './DisplayName';
4
+export { default as DisplayNameLabel } from './DisplayNameLabel';
4 5
 export { default as DisplayNamePrompt } from './DisplayNamePrompt';

+ 2
- 0
react/features/filmstrip/components/_.native.js Wyświetl plik

@@ -1 +1,3 @@
1
+// @flow
2
+
1 3
 export * from './native';

+ 2
- 0
react/features/filmstrip/components/_.web.js Wyświetl plik

@@ -1 +1,3 @@
1
+// @flow
2
+
1 3
 export * from './web';

+ 2
- 0
react/features/filmstrip/components/index.js Wyświetl plik

@@ -1 +1,3 @@
1
+// @flow
2
+
1 3
 export * from './_';

+ 10
- 2
react/features/filmstrip/components/native/Thumbnail.js Wyświetl plik

@@ -17,7 +17,7 @@ import { Container } from '../../../base/react';
17 17
 import { connect } from '../../../base/redux';
18 18
 import { StyleType } from '../../../base/styles';
19 19
 import { getTrackByMediaTypeAndParticipant } from '../../../base/tracks';
20
-
20
+import { DisplayNameLabel } from '../../../display-name';
21 21
 import { RemoteVideoMenu } from '../../../remote-video-menu';
22 22
 
23 23
 import AudioMutedIndicator from './AudioMutedIndicator';
@@ -90,6 +90,11 @@ type Props = {
90 90
      */
91 91
     participant: Object,
92 92
 
93
+    /**
94
+     * Whether to display or hide the display name of the participant in the thumbnail.
95
+     */
96
+    renderDisplayName: ?boolean,
97
+
93 98
     /**
94 99
      * Optional styling to add or override on the Thumbnail component root.
95 100
      */
@@ -119,7 +124,8 @@ class Thumbnail extends Component<Props> {
119 124
             _videoTrack: videoTrack,
120 125
             disablePin,
121 126
             disableTint,
122
-            participant
127
+            participant,
128
+            renderDisplayName
123 129
         } = this.props;
124 130
 
125 131
         // We don't render audio in any of the following:
@@ -163,6 +169,8 @@ class Thumbnail extends Component<Props> {
163 169
                     tintStyle = { _styles.activeThumbnailTint }
164 170
                     zOrder = { 1 } />
165 171
 
172
+                { renderDisplayName && <DisplayNameLabel participantId = { participantId } /> }
173
+
166 174
                 { participant.role === PARTICIPANT_ROLE.MODERATOR
167 175
                     && <View style = { styles.moderatorIndicatorContainer }>
168 176
                         <ModeratorIndicator />

+ 1
- 0
react/features/filmstrip/components/native/TileView.js Wyświetl plik

@@ -302,6 +302,7 @@ class TileView extends Component<Props, State> {
302 302
                     disableTint = { true }
303 303
                     key = { participant.id }
304 304
                     participant = { participant }
305
+                    renderDisplayName = { true }
305 306
                     styleOverrides = { styleOverrides } />));
306 307
     }
307 308
 

+ 2
- 0
react/features/filmstrip/components/native/index.js Wyświetl plik

@@ -1,3 +1,5 @@
1
+// @flow
2
+
1 3
 export { default as Filmstrip } from './Filmstrip';
2 4
 export { default as TileView } from './TileView';
3 5
 export { default as styles } from './styles';

+ 2
- 0
react/features/filmstrip/components/web/index.js Wyświetl plik

@@ -1,3 +1,5 @@
1
+// @flow
2
+
1 3
 export { default as AudioMutedIndicator } from './AudioMutedIndicator';
2 4
 export { default as DominantSpeakerIndicator }
3 5
     from './DominantSpeakerIndicator';

Ładowanie…
Anuluj
Zapisz