瀏覽代碼

fix(self-view) Hide self view when alone in meet as well (#12831)

factor2
Horatiu Muresan 2 年之前
父節點
當前提交
42838e756c
No account linked to committer's email address

+ 10
- 1
modules/UI/videolayout/LargeVideoManager.js 查看文件

@@ -14,11 +14,13 @@ import { i18next } from '../../../react/features/base/i18n';
14 14
 import { JitsiTrackEvents } from '../../../react/features/base/lib-jitsi-meet';
15 15
 import { VIDEO_TYPE } from '../../../react/features/base/media';
16 16
 import {
17
+    getLocalParticipant,
17 18
     getParticipantById,
18 19
     getParticipantDisplayName,
19 20
     isLocalScreenshareParticipant,
20 21
     isScreenShareParticipant
21 22
 } from '../../../react/features/base/participants';
23
+import { getHideSelfView } from '../../../react/features/base/settings/functions.any';
22 24
 import {
23 25
     getVideoTrackByParticipant,
24 26
     trackStreamingStatusChanged
@@ -232,6 +234,10 @@ export default class LargeVideoManager {
232 234
 
233 235
         preUpdate.then(() => {
234 236
             const { id, stream, videoType, resolve } = this.newStreamData;
237
+            const state = APP.store.getState();
238
+            const shouldHideSelfView = getHideSelfView(state);
239
+            const localId = getLocalParticipant(state)?.id;
240
+
235 241
 
236 242
             // FIXME this does not really make sense, because the videoType
237 243
             // (camera or desktop) is a completely different thing than
@@ -245,13 +251,16 @@ export default class LargeVideoManager {
245 251
             // eslint-disable-next-line no-shadow
246 252
             const container = this.getCurrentContainer();
247 253
 
254
+            if (shouldHideSelfView && localId === id) {
255
+                return container.hide();
256
+            }
257
+
248 258
             container.setStream(id, stream, videoType);
249 259
 
250 260
             // change the avatar url on large
251 261
             this.updateAvatar();
252 262
 
253 263
             const isVideoMuted = !stream || stream.isMuted();
254
-            const state = APP.store.getState();
255 264
             const participant = getParticipantById(state, id);
256 265
             const videoTrack = getVideoTrackByParticipant(state, participant);
257 266
 

+ 0
- 11
react/features/base/settings/functions.any.ts 查看文件

@@ -3,7 +3,6 @@ import { IStateful } from '../app/types';
3 3
 import CONFIG_WHITELIST from '../config/configWhitelist';
4 4
 import { IConfigState } from '../config/reducer';
5 5
 import { IJwtState } from '../jwt/reducer';
6
-import { getParticipantCount } from '../participants/functions';
7 6
 import { toState } from '../redux/functions';
8 7
 import { parseURLParams } from '../util/parseURLParams';
9 8
 
@@ -114,16 +113,6 @@ export function shouldHideShareAudioHelper(state: IReduxState): boolean | undefi
114 113
     return state['features/base/settings'].hideShareAudioHelper;
115 114
 }
116 115
 
117
-/**
118
- * Whether we should hide self view.
119
- *
120
- * @param {Object} state - Redux state.
121
- * @returns {boolean}
122
- */
123
-export function shouldHideSelfView(state: IReduxState) {
124
-    return getParticipantCount(state) === 1 ? false : getHideSelfView(state);
125
-}
126
-
127 116
 /**
128 117
  * Gets the disable self view setting.
129 118
  *

+ 3
- 3
react/features/filmstrip/actions.web.ts 查看文件

@@ -5,7 +5,7 @@ import {
5 5
     getParticipantById,
6 6
     getRemoteParticipantCountWithFake
7 7
 } from '../base/participants/functions';
8
-import { shouldHideSelfView } from '../base/settings/functions.web';
8
+import { getHideSelfView } from '../base/settings/functions.any';
9 9
 import { getMaxColumnCount } from '../video-layout/functions.web';
10 10
 
11 11
 import {
@@ -146,7 +146,7 @@ export function setVerticalViewDimensions() {
146 146
         const state = getState();
147 147
         const { clientHeight = 0, clientWidth = 0 } = state['features/base/responsive-ui'];
148 148
         const { width: filmstripWidth } = state['features/filmstrip'];
149
-        const disableSelfView = shouldHideSelfView(state);
149
+        const disableSelfView = getHideSelfView(state);
150 150
         const resizableFilmstrip = isFilmstripResizable(state);
151 151
         const _verticalViewGrid = showGridInVerticalView(state);
152 152
         const numberOfRemoteParticipants = getRemoteParticipantCountWithFake(state);
@@ -255,7 +255,7 @@ export function setHorizontalViewDimensions() {
255 255
     return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
256 256
         const state = getState();
257 257
         const { clientHeight = 0, clientWidth = 0 } = state['features/base/responsive-ui'];
258
-        const disableSelfView = shouldHideSelfView(state);
258
+        const disableSelfView = getHideSelfView(state);
259 259
         const thumbnails = calculateThumbnailSizeForHorizontalView(clientHeight);
260 260
         const remoteVideosContainerWidth
261 261
             = clientWidth - (disableSelfView ? 0 : thumbnails?.local?.width) - HORIZONTAL_FILMSTRIP_MARGIN;

+ 2
- 2
react/features/filmstrip/components/native/Filmstrip.js 查看文件

@@ -8,7 +8,7 @@ import { getLocalParticipant } from '../../../base/participants';
8 8
 import { Platform } from '../../../base/react';
9 9
 import { connect } from '../../../base/redux';
10 10
 import { ASPECT_RATIO_NARROW } from '../../../base/responsive-ui/constants';
11
-import { shouldHideSelfView } from '../../../base/settings/functions.any';
11
+import { getHideSelfView } from '../../../base/settings/functions.any';
12 12
 import { isToolboxVisible } from '../../../toolbox/functions';
13 13
 import { setVisibleRemoteParticipants } from '../../actions';
14 14
 import {
@@ -320,7 +320,7 @@ class Filmstrip extends PureComponent<Props> {
320 320
  */
321 321
 function _mapStateToProps(state) {
322 322
     const { enabled, remoteParticipants } = state['features/filmstrip'];
323
-    const disableSelfView = shouldHideSelfView(state);
323
+    const disableSelfView = getHideSelfView(state);
324 324
     const showRemoteVideos = shouldRemoteVideosBeVisible(state);
325 325
     const responsiveUI = state['features/base/responsive-ui'];
326 326
 

+ 2
- 2
react/features/filmstrip/components/native/TileView.js 查看文件

@@ -11,7 +11,7 @@ import type { Dispatch } from 'redux';
11 11
 
12 12
 import { getLocalParticipant, getParticipantCountWithFake } from '../../../base/participants';
13 13
 import { connect } from '../../../base/redux';
14
-import { shouldHideSelfView } from '../../../base/settings/functions.any';
14
+import { getHideSelfView } from '../../../base/settings/functions.any';
15 15
 import { setVisibleRemoteParticipants } from '../../actions.web';
16 16
 
17 17
 import Thumbnail from './Thumbnail';
@@ -283,7 +283,7 @@ class TileView extends PureComponent<Props> {
283 283
 function _mapStateToProps(state, ownProps) {
284 284
     const responsiveUi = state['features/base/responsive-ui'];
285 285
     const { remoteParticipants, tileViewDimensions } = state['features/filmstrip'];
286
-    const disableSelfView = shouldHideSelfView(state);
286
+    const disableSelfView = getHideSelfView(state);
287 287
     const { height } = tileViewDimensions.thumbnailSize;
288 288
     const { columns } = tileViewDimensions;
289 289
 

+ 2
- 2
react/features/filmstrip/components/web/Filmstrip.tsx 查看文件

@@ -16,7 +16,7 @@ import Icon from '../../../base/icons/components/Icon';
16 16
 import { IconArrowDown, IconArrowUp } from '../../../base/icons/svg';
17 17
 import { IParticipant } from '../../../base/participants/types';
18 18
 import { connect } from '../../../base/redux/functions';
19
-import { shouldHideSelfView } from '../../../base/settings/functions.web';
19
+import { getHideSelfView } from '../../../base/settings/functions.any';
20 20
 import { showToolbox } from '../../../toolbox/actions.web';
21 21
 import { isButtonEnabled, isToolboxVisible } from '../../../toolbox/functions.web';
22 22
 import { LAYOUTS } from '../../../video-layout/constants';
@@ -877,7 +877,7 @@ function _mapStateToProps(state: IReduxState, ownProps: Partial<IProps>) {
877 877
     const reduceHeight = state['features/toolbox'].visible && toolbarButtons.length;
878 878
     const remoteVideosVisible = shouldRemoteVideosBeVisible(state);
879 879
     const { isOpen: shiftRight } = state['features/chat'];
880
-    const disableSelfView = shouldHideSelfView(state);
880
+    const disableSelfView = getHideSelfView(state);
881 881
     const { clientWidth, clientHeight } = state['features/base/responsive-ui'];
882 882
 
883 883
     const collapseTileView = reduceHeight

+ 2
- 2
react/features/filmstrip/components/web/ThumbnailWrapper.js 查看文件

@@ -4,7 +4,7 @@ import { shouldComponentUpdate } from 'react-window';
4 4
 
5 5
 import { getLocalParticipant } from '../../../base/participants';
6 6
 import { connect } from '../../../base/redux';
7
-import { shouldHideSelfView } from '../../../base/settings/functions.any';
7
+import { getHideSelfView } from '../../../base/settings/functions.any';
8 8
 import { LAYOUTS, getCurrentLayout } from '../../../video-layout';
9 9
 import { FILMSTRIP_TYPE, TILE_ASPECT_RATIO, TILE_HORIZONTAL_MARGIN } from '../../constants';
10 10
 import { getActiveParticipantsIds, showGridInVerticalView } from '../../functions';
@@ -152,7 +152,7 @@ function _mapStateToProps(state, ownProps) {
152 152
     const _currentLayout = getCurrentLayout(state);
153 153
     const { remoteParticipants: remote } = state['features/filmstrip'];
154 154
     const activeParticipants = getActiveParticipantsIds(state);
155
-    const disableSelfView = shouldHideSelfView(state);
155
+    const disableSelfView = getHideSelfView(state);
156 156
     const _verticalViewGrid = showGridInVerticalView(state);
157 157
     const filmstripType = ownProps.data?.filmstripType;
158 158
     const stageFilmstrip = filmstripType === FILMSTRIP_TYPE.STAGE;

+ 3
- 3
react/features/filmstrip/functions.native.ts 查看文件

@@ -10,7 +10,7 @@ import {
10 10
 import Platform from '../base/react/Platform.native';
11 11
 import { toState } from '../base/redux/functions';
12 12
 import { ASPECT_RATIO_NARROW } from '../base/responsive-ui/constants';
13
-import { shouldHideSelfView } from '../base/settings/functions.native';
13
+import { getHideSelfView } from '../base/settings/functions.any';
14 14
 // eslint-disable-next-line lines-around-comment
15 15
 // @ts-ignore
16 16
 import conferenceStyles from '../conference/components/native/styles';
@@ -104,7 +104,7 @@ export function getPinnedActiveParticipants(_state: any) {
104 104
  */
105 105
 export function getTileViewParticipantCount(stateful: IStateful) {
106 106
     const state = toState(stateful);
107
-    const disableSelfView = shouldHideSelfView(state);
107
+    const disableSelfView = getHideSelfView(state);
108 108
     const localParticipant = getLocalParticipant(state);
109 109
     const participantCount = getParticipantCountWithFake(state) - (disableSelfView && localParticipant ? 1 : 0);
110 110
 
@@ -152,7 +152,7 @@ export function isFilmstripScrollVisible(state: IReduxState) {
152 152
 
153 153
     const { aspectRatio, clientWidth, clientHeight, safeAreaInsets = {} } = state['features/base/responsive-ui'];
154 154
     const isNarrowAspectRatio = aspectRatio === ASPECT_RATIO_NARROW;
155
-    const disableSelfView = shouldHideSelfView(state);
155
+    const disableSelfView = getHideSelfView(state);
156 156
     const localParticipant = Boolean(getLocalParticipant(state));
157 157
     const localParticipantVisible = localParticipant && !disableSelfView;
158 158
     const participantCount

+ 2
- 2
react/features/filmstrip/functions.web.ts 查看文件

@@ -11,7 +11,7 @@ import {
11 11
     isScreenShareParticipant
12 12
 } from '../base/participants/functions';
13 13
 import { toState } from '../base/redux/functions';
14
-import { shouldHideSelfView } from '../base/settings/functions.web';
14
+import { getHideSelfView } from '../base/settings/functions.any';
15 15
 import {
16 16
     getVideoTrackByParticipant,
17 17
     isLocalTrackMuted,
@@ -218,7 +218,7 @@ export function getTileDefaultAspectRatio(disableResponsiveTiles: boolean,
218 218
  */
219 219
 export function getNumberOfPartipantsForTileView(state: IReduxState) {
220 220
     const { iAmRecorder } = state['features/base/config'];
221
-    const disableSelfView = shouldHideSelfView(state);
221
+    const disableSelfView = getHideSelfView(state);
222 222
     const { localScreenShare } = state['features/base/participants'];
223 223
     const localParticipantsCount = localScreenShare ? 2 : 1;
224 224
     const numberOfParticipants = getParticipantCountWithFake(state)

+ 2
- 2
react/features/filmstrip/subscriber.web.ts 查看文件

@@ -2,7 +2,7 @@ import { pinParticipant } from '../base/participants/actions';
2 2
 import { getParticipantCountWithFake } from '../base/participants/functions';
3 3
 import StateListenerRegistry from '../base/redux/StateListenerRegistry';
4 4
 import { clientResized, setNarrowLayout } from '../base/responsive-ui/actions';
5
-import { shouldHideSelfView } from '../base/settings/functions.web';
5
+import { getHideSelfView } from '../base/settings/functions.any';
6 6
 import { selectParticipantInLargeVideo } from '../large-video/actions.any';
7 7
 import { getParticipantsPaneOpen } from '../participants-pane/functions';
8 8
 import { setOverflowDrawer } from '../toolbox/actions.web';
@@ -37,7 +37,7 @@ StateListenerRegistry.register(
37 37
     /* selector */ state => {
38 38
         return {
39 39
             numberOfParticipants: getParticipantCountWithFake(state),
40
-            disableSelfView: shouldHideSelfView(state),
40
+            disableSelfView: getHideSelfView(state),
41 41
             localScreenShare: state['features/base/participants'].localScreenShare
42 42
         };
43 43
     },

+ 25
- 1
react/features/large-video/components/LargeVideo.web.js 查看文件

@@ -7,6 +7,7 @@ import { VIDEO_TYPE } from '../../base/media';
7 7
 import { getLocalParticipant } from '../../base/participants';
8 8
 import { Watermarks } from '../../base/react';
9 9
 import { connect } from '../../base/redux';
10
+import { getHideSelfView } from '../../base/settings/functions.any';
10 11
 import { getVideoTrackByParticipant } from '../../base/tracks';
11 12
 import { setColorAlpha } from '../../base/util';
12 13
 import { StageParticipantNameLabel } from '../../display-name';
@@ -105,6 +106,16 @@ type Props = {
105 106
      */
106 107
     _whiteboardEnabled: boolean;
107 108
 
109
+     /**
110
+     * Whether or not the hideSelfView is enabled.
111
+     */
112
+    _hideSelfView: boolean;
113
+
114
+    /**
115
+     * Local Participant id.
116
+     */
117
+    _localParticipantId: string;
118
+
108 119
     /**
109 120
      * The Redux dispatch function.
110 121
      */
@@ -146,7 +157,13 @@ class LargeVideo extends Component<Props> {
146 157
      * @inheritdoc
147 158
      */
148 159
     componentDidUpdate(prevProps: Props) {
149
-        const { _visibleFilmstrip, _isScreenSharing, _seeWhatIsBeingShared, _largeVideoParticipantId } = this.props;
160
+        const {
161
+            _visibleFilmstrip,
162
+            _isScreenSharing,
163
+            _seeWhatIsBeingShared,
164
+            _largeVideoParticipantId,
165
+            _hideSelfView,
166
+            _localParticipantId } = this.props;
150 167
 
151 168
         if (prevProps._visibleFilmstrip !== _visibleFilmstrip) {
152 169
             this._updateLayout();
@@ -159,6 +176,11 @@ class LargeVideo extends Component<Props> {
159 176
         if (_isScreenSharing && _seeWhatIsBeingShared) {
160 177
             VideoLayout.updateLargeVideo(_largeVideoParticipantId, true, true);
161 178
         }
179
+
180
+        if (_largeVideoParticipantId === _localParticipantId
181
+            && prevProps._hideSelfView !== _hideSelfView) {
182
+            VideoLayout.updateLargeVideo(_largeVideoParticipantId, true, false);
183
+        }
162 184
     }
163 185
 
164 186
     /**
@@ -351,9 +373,11 @@ function _mapStateToProps(state) {
351 373
         _customBackgroundColor: backgroundColor,
352 374
         _customBackgroundImageUrl: backgroundImageUrl,
353 375
         _displayScreenSharingPlaceholder: isLocalScreenshareOnLargeVideo && !seeWhatIsBeingShared && !isOnSpot,
376
+        _hideSelfView: getHideSelfView(state),
354 377
         _isChatOpen: isChatOpen,
355 378
         _isScreenSharing: isLocalScreenshareOnLargeVideo,
356 379
         _largeVideoParticipantId: largeVideoParticipant?.id,
380
+        _localParticipantId: localParticipantId,
357 381
         _noAutoPlayVideo: testingConfig?.noAutoPlayVideo,
358 382
         _resizableFilmstrip: isFilmstripResizable(state),
359 383
         _seeWhatIsBeingShared: seeWhatIsBeingShared,

Loading…
取消
儲存