Kaynağa Gözat

feat(rn,filmstrip) add 1on1 mode

When there are only 2 participants in a call, don't show the remote thumbnail,
unless the `disable1On1Mode` config option is set or the local participant pin
themselves.
master
Saúl Ibarra Corretgé 3 yıl önce
ebeveyn
işleme
1433a1ee5d

+ 6
- 2
react/features/filmstrip/components/native/Filmstrip.js Dosyayı Görüntüle

6
 import { Platform } from '../../../base/react';
6
 import { Platform } from '../../../base/react';
7
 import { connect } from '../../../base/redux';
7
 import { connect } from '../../../base/redux';
8
 import { ASPECT_RATIO_NARROW } from '../../../base/responsive-ui/constants';
8
 import { ASPECT_RATIO_NARROW } from '../../../base/responsive-ui/constants';
9
-import { isFilmstripVisible } from '../../functions';
9
+import { isFilmstripVisible, shouldRemoteVideosBeVisible } from '../../functions';
10
 
10
 
11
 import LocalThumbnail from './LocalThumbnail';
11
 import LocalThumbnail from './LocalThumbnail';
12
 import Thumbnail from './Thumbnail';
12
 import Thumbnail from './Thumbnail';
13
 import styles from './styles';
13
 import styles from './styles';
14
 
14
 
15
+// Immutable reference to avoid re-renders.
16
+const NO_REMOTE_VIDEOS = [];
17
+
15
 /**
18
 /**
16
  * Filmstrip component's property types.
19
  * Filmstrip component's property types.
17
  */
20
  */
167
  */
170
  */
168
 function _mapStateToProps(state) {
171
 function _mapStateToProps(state) {
169
     const { enabled, remoteParticipants } = state['features/filmstrip'];
172
     const { enabled, remoteParticipants } = state['features/filmstrip'];
173
+    const showRemoteVideos = shouldRemoteVideosBeVisible(state);
170
 
174
 
171
     return {
175
     return {
172
         _aspectRatio: state['features/base/responsive-ui'].aspectRatio,
176
         _aspectRatio: state['features/base/responsive-ui'].aspectRatio,
173
-        _participants: remoteParticipants,
177
+        _participants: showRemoteVideos ? remoteParticipants : NO_REMOTE_VIDEOS,
174
         _visible: enabled && isFilmstripVisible(state)
178
         _visible: enabled && isFilmstripVisible(state)
175
     };
179
     };
176
 }
180
 }

+ 32
- 1
react/features/filmstrip/functions.native.js Dosyayı Görüntüle

1
 // @flow
1
 // @flow
2
 
2
 
3
 import { getFeatureFlag, FILMSTRIP_ENABLED } from '../base/flags';
3
 import { getFeatureFlag, FILMSTRIP_ENABLED } from '../base/flags';
4
-import { getParticipantCountWithFake } from '../base/participants';
4
+import { getParticipantCountWithFake, getPinnedParticipant } from '../base/participants';
5
 import { toState } from '../base/redux';
5
 import { toState } from '../base/redux';
6
 
6
 
7
 /**
7
 /**
26
     return getParticipantCountWithFake(state) > 1;
26
     return getParticipantCountWithFake(state) > 1;
27
 }
27
 }
28
 
28
 
29
+/**
30
+ * Determines whether the remote video thumbnails should be displayed/visible in
31
+ * the filmstrip.
32
+ *
33
+ * @param {Object} state - The full redux state.
34
+ * @returns {boolean} - If remote video thumbnails should be displayed/visible
35
+ * in the filmstrip, then {@code true}; otherwise, {@code false}.
36
+ */
37
+export function shouldRemoteVideosBeVisible(state: Object) {
38
+    if (state['features/invite'].calleeInfoVisible) {
39
+        return false;
40
+    }
41
+
42
+    // Include fake participants to derive how many thumbnails are dispalyed,
43
+    // as it is assumed all participants, including fake, will be displayed
44
+    // in the filmstrip.
45
+    const participantCount = getParticipantCountWithFake(state);
46
+    const pinnedParticipant = getPinnedParticipant(state);
47
+    const { disable1On1Mode } = state['features/base/config'];
48
+
49
+    return Boolean(
50
+        participantCount > 2
51
+
52
+            // Always show the filmstrip when there is another participant to
53
+            // show and the local video is pinned. Note we are not taking the
54
+            // toolbar visibility into account here (unlike web) because
55
+            // showing / hiding views in quick succession on mobile is taxing.
56
+            || (participantCount > 1 && pinnedParticipant?.local)
57
+
58
+            || disable1On1Mode);
59
+}

Loading…
İptal
Kaydet