Преглед изворни кода

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

+ 0
- 11
react/features/base/settings/functions.any.ts Прегледај датотеку

3
 import CONFIG_WHITELIST from '../config/configWhitelist';
3
 import CONFIG_WHITELIST from '../config/configWhitelist';
4
 import { IConfigState } from '../config/reducer';
4
 import { IConfigState } from '../config/reducer';
5
 import { IJwtState } from '../jwt/reducer';
5
 import { IJwtState } from '../jwt/reducer';
6
-import { getParticipantCount } from '../participants/functions';
7
 import { toState } from '../redux/functions';
6
 import { toState } from '../redux/functions';
8
 import { parseURLParams } from '../util/parseURLParams';
7
 import { parseURLParams } from '../util/parseURLParams';
9
 
8
 
114
     return state['features/base/settings'].hideShareAudioHelper;
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
  * Gets the disable self view setting.
117
  * Gets the disable self view setting.
129
  *
118
  *

+ 3
- 3
react/features/filmstrip/actions.web.ts Прегледај датотеку

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

+ 2
- 2
react/features/filmstrip/components/native/Filmstrip.js Прегледај датотеку

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

+ 2
- 2
react/features/filmstrip/components/native/TileView.js Прегледај датотеку

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

+ 2
- 2
react/features/filmstrip/components/web/Filmstrip.tsx Прегледај датотеку

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

+ 2
- 2
react/features/filmstrip/components/web/ThumbnailWrapper.js Прегледај датотеку

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

+ 3
- 3
react/features/filmstrip/functions.native.ts Прегледај датотеку

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

+ 2
- 2
react/features/filmstrip/functions.web.ts Прегледај датотеку

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

+ 2
- 2
react/features/filmstrip/subscriber.web.ts Прегледај датотеку

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

+ 25
- 1
react/features/large-video/components/LargeVideo.web.js Прегледај датотеку

7
 import { getLocalParticipant } from '../../base/participants';
7
 import { getLocalParticipant } from '../../base/participants';
8
 import { Watermarks } from '../../base/react';
8
 import { Watermarks } from '../../base/react';
9
 import { connect } from '../../base/redux';
9
 import { connect } from '../../base/redux';
10
+import { getHideSelfView } from '../../base/settings/functions.any';
10
 import { getVideoTrackByParticipant } from '../../base/tracks';
11
 import { getVideoTrackByParticipant } from '../../base/tracks';
11
 import { setColorAlpha } from '../../base/util';
12
 import { setColorAlpha } from '../../base/util';
12
 import { StageParticipantNameLabel } from '../../display-name';
13
 import { StageParticipantNameLabel } from '../../display-name';
105
      */
106
      */
106
     _whiteboardEnabled: boolean;
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
      * The Redux dispatch function.
120
      * The Redux dispatch function.
110
      */
121
      */
146
      * @inheritdoc
157
      * @inheritdoc
147
      */
158
      */
148
     componentDidUpdate(prevProps: Props) {
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
         if (prevProps._visibleFilmstrip !== _visibleFilmstrip) {
168
         if (prevProps._visibleFilmstrip !== _visibleFilmstrip) {
152
             this._updateLayout();
169
             this._updateLayout();
159
         if (_isScreenSharing && _seeWhatIsBeingShared) {
176
         if (_isScreenSharing && _seeWhatIsBeingShared) {
160
             VideoLayout.updateLargeVideo(_largeVideoParticipantId, true, true);
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
         _customBackgroundColor: backgroundColor,
373
         _customBackgroundColor: backgroundColor,
352
         _customBackgroundImageUrl: backgroundImageUrl,
374
         _customBackgroundImageUrl: backgroundImageUrl,
353
         _displayScreenSharingPlaceholder: isLocalScreenshareOnLargeVideo && !seeWhatIsBeingShared && !isOnSpot,
375
         _displayScreenSharingPlaceholder: isLocalScreenshareOnLargeVideo && !seeWhatIsBeingShared && !isOnSpot,
376
+        _hideSelfView: getHideSelfView(state),
354
         _isChatOpen: isChatOpen,
377
         _isChatOpen: isChatOpen,
355
         _isScreenSharing: isLocalScreenshareOnLargeVideo,
378
         _isScreenSharing: isLocalScreenshareOnLargeVideo,
356
         _largeVideoParticipantId: largeVideoParticipant?.id,
379
         _largeVideoParticipantId: largeVideoParticipant?.id,
380
+        _localParticipantId: localParticipantId,
357
         _noAutoPlayVideo: testingConfig?.noAutoPlayVideo,
381
         _noAutoPlayVideo: testingConfig?.noAutoPlayVideo,
358
         _resizableFilmstrip: isFilmstripResizable(state),
382
         _resizableFilmstrip: isFilmstripResizable(state),
359
         _seeWhatIsBeingShared: seeWhatIsBeingShared,
383
         _seeWhatIsBeingShared: seeWhatIsBeingShared,

Loading…
Откажи
Сачувај