Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(disableSelfView) enable disable self view when alone in meeting #12504

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 36 additions & 2 deletions modules/UI/videolayout/VideoContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import React from 'react';
import ReactDOM from 'react-dom';

import { browser } from '../../../react/features/base/lib-jitsi-meet';
import { getParticipantCount } from '../../../react/features/base/participants';
import { getHideSelfView } from '../../../react/features/base/settings/functions.any';
import { isTestModeEnabled } from '../../../react/features/base/testing';
import { isLocalCameraTrackMuted } from '../../../react/features/base/tracks';
import { FILMSTRIP_BREAKPOINT } from '../../../react/features/filmstrip';
import { LargeVideoBackground, ORIENTATION, updateLastLargeVideoMediaEvent } from '../../../react/features/large-video';
import { setLargeVideoDimensions } from '../../../react/features/large-video/actions.any';
Expand Down Expand Up @@ -558,12 +561,37 @@ export class VideoContainer extends LargeContainer {
* @param {boolean} show
*/
showAvatar(show) {
this.$avatar.css('visibility', show ? 'visible' : 'hidden');
const state = APP.store.getState();
const aloneInTheMeeting = getParticipantCount(state) === 1;

const visibility = aloneInTheMeeting
? this.setAvatarVisibility(state)
: show ? 'visible' : 'hidden';

this.$avatar.css('visibility', visibility);
this.avatarDisplayed = show;

APP.API.notifyLargeVideoVisibilityChanged(show);
}

/**
* Set Avatar Visibility.
* @param {object} state - App state.
*/
setAvatarVisibility(state) {
const hideSelfView = getHideSelfView(state);
let visibility = 'hidden';

if (!hideSelfView) {
const tracks = state['features/base/tracks'];
const isVideoMuted = isLocalCameraTrackMuted(tracks);

visibility = isVideoMuted ? 'visible' : 'hidden';
}

return visibility;
}

/**
* We are doing fadeOut/fadeIn animations on parent div which wraps
* largeVideo, because when Temasys plugin is in use it replaces
Expand All @@ -575,7 +603,13 @@ export class VideoContainer extends LargeContainer {
*/
show() {
return new Promise(resolve => {
this.$wrapperParent.css('visibility', 'visible').fadeTo(
const state = APP.store.getState();
const aloneInTheMeeting = getParticipantCount(state) === 1;
const hideSelfView = getHideSelfView(state);

const visibility = aloneInTheMeeting && hideSelfView ? 'hidden' : 'visible';

this.$wrapperParent.css('visibility', visibility).fadeTo(
FADE_DURATION_MS,
1,
() => {
Expand Down
11 changes: 0 additions & 11 deletions react/features/base/settings/functions.any.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { IStateful } from '../app/types';
import CONFIG_WHITELIST from '../config/configWhitelist';
import { IConfigState } from '../config/reducer';
import { IJwtState } from '../jwt/reducer';
import { getParticipantCount } from '../participants/functions';
import { toState } from '../redux/functions';
import { parseURLParams } from '../util/parseURLParams';

Expand Down Expand Up @@ -114,16 +113,6 @@ export function shouldHideShareAudioHelper(state: IReduxState): boolean | undefi
return state['features/base/settings'].hideShareAudioHelper;
}

/**
* Whether we should hide self view.
*
* @param {Object} state - Redux state.
* @returns {boolean}
*/
export function shouldHideSelfView(state: IReduxState) {
return getParticipantCount(state) === 1 ? false : getHideSelfView(state);
}

/**
* Gets the disable self view setting.
*
Expand Down
6 changes: 3 additions & 3 deletions react/features/filmstrip/actions.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
getRemoteParticipantCount,
pinParticipant
} from '../base/participants';
import { shouldHideSelfView } from '../base/settings/functions.any';
import { getHideSelfView } from '../base/settings/functions.any';
import { getMaxColumnCount } from '../video-layout';

import {
Expand Down Expand Up @@ -149,7 +149,7 @@ export function setVerticalViewDimensions() {
const state = getState();
const { clientHeight = 0, clientWidth = 0 } = state['features/base/responsive-ui'];
const { width: filmstripWidth } = state['features/filmstrip'];
const disableSelfView = shouldHideSelfView(state);
const disableSelfView = getHideSelfView(state);
const resizableFilmstrip = isFilmstripResizable(state);
const _verticalViewGrid = showGridInVerticalView(state);
const numberOfRemoteParticipants = getRemoteParticipantCount(state);
Expand Down Expand Up @@ -258,7 +258,7 @@ export function setHorizontalViewDimensions() {
return (dispatch: Dispatch<any>, getState: Function) => {
const state = getState();
const { clientHeight = 0, clientWidth = 0 } = state['features/base/responsive-ui'];
const disableSelfView = shouldHideSelfView(state);
const disableSelfView = getHideSelfView(state);
const thumbnails = calculateThumbnailSizeForHorizontalView(clientHeight);
const remoteVideosContainerWidth
= clientWidth - (disableSelfView ? 0 : thumbnails?.local?.width) - HORIZONTAL_FILMSTRIP_MARGIN;
Expand Down
4 changes: 2 additions & 2 deletions react/features/filmstrip/components/native/Filmstrip.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { getLocalParticipant } from '../../../base/participants';
import { Platform } from '../../../base/react';
import { connect } from '../../../base/redux';
import { ASPECT_RATIO_NARROW } from '../../../base/responsive-ui/constants';
import { shouldHideSelfView } from '../../../base/settings/functions.any';
import { getHideSelfView } from '../../../base/settings/functions.any';
import { isToolboxVisible } from '../../../toolbox/functions';
import { setVisibleRemoteParticipants } from '../../actions';
import {
Expand Down Expand Up @@ -320,7 +320,7 @@ class Filmstrip extends PureComponent<Props> {
*/
function _mapStateToProps(state) {
const { enabled, remoteParticipants } = state['features/filmstrip'];
const disableSelfView = shouldHideSelfView(state);
const disableSelfView = getHideSelfView(state);
const showRemoteVideos = shouldRemoteVideosBeVisible(state);
const responsiveUI = state['features/base/responsive-ui'];

Expand Down
4 changes: 2 additions & 2 deletions react/features/filmstrip/components/native/TileView.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { Dispatch } from 'redux';

import { getLocalParticipant, getParticipantCountWithFake } from '../../../base/participants';
import { connect } from '../../../base/redux';
import { shouldHideSelfView } from '../../../base/settings/functions.any';
import { getHideSelfView } from '../../../base/settings/functions.any';
import { setVisibleRemoteParticipants } from '../../actions.web';

import Thumbnail from './Thumbnail';
Expand Down Expand Up @@ -283,7 +283,7 @@ class TileView extends PureComponent<Props> {
function _mapStateToProps(state, ownProps) {
const responsiveUi = state['features/base/responsive-ui'];
const { remoteParticipants, tileViewDimensions } = state['features/filmstrip'];
const disableSelfView = shouldHideSelfView(state);
const disableSelfView = getHideSelfView(state);
const { height } = tileViewDimensions.thumbnailSize;
const { columns } = tileViewDimensions;

Expand Down
4 changes: 2 additions & 2 deletions react/features/filmstrip/components/web/Filmstrip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import Icon from '../../../base/icons/components/Icon';
import { IconMenuDown, IconMenuUp } from '../../../base/icons/svg';
import { IParticipant } from '../../../base/participants/types';
import { connect } from '../../../base/redux/functions';
import { shouldHideSelfView } from '../../../base/settings/functions.any';
import { getHideSelfView } from '../../../base/settings/functions.any';
// @ts-ignore
import { showToolbox } from '../../../toolbox/actions.web';
import { isButtonEnabled, isToolboxVisible } from '../../../toolbox/functions.web';
Expand Down Expand Up @@ -881,7 +881,7 @@ function _mapStateToProps(state: IReduxState, ownProps: Partial<IProps>) {
const reduceHeight = state['features/toolbox'].visible && toolbarButtons.length;
const remoteVideosVisible = shouldRemoteVideosBeVisible(state);
const { isOpen: shiftRight } = state['features/chat'];
const disableSelfView = shouldHideSelfView(state);
const disableSelfView = getHideSelfView(state);
const { clientWidth, clientHeight } = state['features/base/responsive-ui'];

const collapseTileView = reduceHeight
Expand Down
4 changes: 2 additions & 2 deletions react/features/filmstrip/components/web/ThumbnailWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { shouldComponentUpdate } from 'react-window';
import { getSourceNameSignalingFeatureFlag } from '../../../base/config';
import { getLocalParticipant } from '../../../base/participants';
import { connect } from '../../../base/redux';
import { shouldHideSelfView } from '../../../base/settings/functions.any';
import { getHideSelfView } from '../../../base/settings/functions.any';
import { LAYOUTS, getCurrentLayout } from '../../../video-layout';
import { FILMSTRIP_TYPE, TILE_ASPECT_RATIO, TILE_HORIZONTAL_MARGIN } from '../../constants';
import { getActiveParticipantsIds, showGridInVerticalView } from '../../functions';
Expand Down Expand Up @@ -153,7 +153,7 @@ function _mapStateToProps(state, ownProps) {
const _currentLayout = getCurrentLayout(state);
const { remoteParticipants: remote } = state['features/filmstrip'];
const activeParticipants = getActiveParticipantsIds(state);
const disableSelfView = shouldHideSelfView(state);
const disableSelfView = getHideSelfView(state);
const sourceNameSignalingEnabled = getSourceNameSignalingFeatureFlag(state);
const _verticalViewGrid = showGridInVerticalView(state);
const filmstripType = ownProps.data?.filmstripType;
Expand Down
6 changes: 3 additions & 3 deletions react/features/filmstrip/functions.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import { Platform } from '../base/react';
import { toState } from '../base/redux';
import { ASPECT_RATIO_NARROW } from '../base/responsive-ui/constants';
import { shouldHideSelfView } from '../base/settings/functions.any';
import { getHideSelfView } from '../base/settings/functions.any';
import conferenceStyles from '../conference/components/native/styles';
import { shouldDisplayTileView } from '../video-layout';

Expand Down Expand Up @@ -89,7 +89,7 @@ export function getActiveParticipantsIds() {
*/
export function getTileViewParticipantCount(stateful: Object | Function) {
const state = toState(stateful);
const disableSelfView = shouldHideSelfView(state);
const disableSelfView = getHideSelfView(state);
const localParticipant = getLocalParticipant(state);
const participantCount = getParticipantCountWithFake(state) - (disableSelfView && localParticipant ? 1 : 0);

Expand Down Expand Up @@ -137,7 +137,7 @@ export function isFilmstripScrollVisible(state) {

const { aspectRatio, clientWidth, clientHeight, safeAreaInsets = {} } = state['features/base/responsive-ui'];
const isNarrowAspectRatio = aspectRatio === ASPECT_RATIO_NARROW;
const disableSelfView = shouldHideSelfView(state);
const disableSelfView = getHideSelfView(state);
const localParticipant = Boolean(getLocalParticipant(state));
const localParticipantVisible = localParticipant && !disableSelfView;
const participantCount
Expand Down
4 changes: 2 additions & 2 deletions react/features/filmstrip/functions.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
isScreenShareParticipant
} from '../base/participants';
import { toState } from '../base/redux';
import { shouldHideSelfView } from '../base/settings/functions.any';
import { getHideSelfView } from '../base/settings/functions.any';
import {
getLocalVideoTrack,
getTrackByMediaTypeAndParticipant,
Expand Down Expand Up @@ -233,7 +233,7 @@ export function getTileDefaultAspectRatio(disableResponsiveTiles, disableTileEnl
*/
export function getNumberOfPartipantsForTileView(state) {
const { iAmRecorder } = state['features/base/config'];
const disableSelfView = shouldHideSelfView(state);
const disableSelfView = getHideSelfView(state);
const { localScreenShare } = state['features/base/participants'];
const localParticipantsCount = getSourceNameSignalingFeatureFlag(state) && localScreenShare ? 2 : 1;
const numberOfParticipants = getParticipantCountWithFake(state)
Expand Down
4 changes: 2 additions & 2 deletions react/features/filmstrip/subscriber.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { isMobileBrowser } from '../base/environment/utils';
import { getParticipantCountWithFake, pinParticipant } from '../base/participants';
import { StateListenerRegistry } from '../base/redux';
import { clientResized } from '../base/responsive-ui';
import { shouldHideSelfView } from '../base/settings';
import { getHideSelfView } from '../base/settings/functions.any';
import { setFilmstripVisible } from '../filmstrip/actions';
import { selectParticipantInLargeVideo } from '../large-video/actions.any';
import { getParticipantsPaneOpen } from '../participants-pane/functions';
Expand Down Expand Up @@ -39,7 +39,7 @@ StateListenerRegistry.register(
/* selector */ state => {
return {
numberOfParticipants: getParticipantCountWithFake(state),
disableSelfView: shouldHideSelfView(state),
disableSelfView: getHideSelfView(state),
localScreenShare: state['features/base/participants'].localScreenShare
};
},
Expand Down
36 changes: 33 additions & 3 deletions react/features/large-video/components/LargeVideo.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import React, { Component } from 'react';
import VideoLayout from '../../../../modules/UI/videolayout/VideoLayout';
import { getMultipleVideoSupportFeatureFlag } from '../../base/config';
import { MEDIA_TYPE, VIDEO_TYPE } from '../../base/media';
import { getLocalParticipant, isScreenShareParticipant } from '../../base/participants';
import { getLocalParticipant, getParticipantCount, isScreenShareParticipant } from '../../base/participants';
import { Watermarks } from '../../base/react';
import { connect } from '../../base/redux';
import { getHideSelfView } from '../../base/settings/functions.any';
import { getTrackByMediaTypeAndParticipant, getVirtualScreenshareParticipantTrack } from '../../base/tracks';
import { setColorAlpha } from '../../base/util';
import { StageParticipantNameLabel } from '../../display-name';
Expand Down Expand Up @@ -106,6 +107,21 @@ type Props = {
*/
_whiteboardEnabled: boolean;

/**
* Whether or not the hideSelfView is enabled.
*/
_hideSelfView: boolean;

/**
* Whether or not is only 1 participant in the meeting.
*/
_aloneInTheMeeting: boolean;

/**
* Local Participant id.
*/
_localParticipantId: string;

/**
* The Redux dispatch function.
*/
Expand Down Expand Up @@ -147,7 +163,14 @@ class LargeVideo extends Component<Props> {
* @inheritdoc
*/
componentDidUpdate(prevProps: Props) {
const { _visibleFilmstrip, _isScreenSharing, _seeWhatIsBeingShared, _largeVideoParticipantId } = this.props;
const {
_visibleFilmstrip,
_isScreenSharing,
_seeWhatIsBeingShared,
_largeVideoParticipantId,
_hideSelfView,
_localParticipantId,
_aloneInTheMeeting } = this.props;

if (prevProps._visibleFilmstrip !== _visibleFilmstrip) {
this._updateLayout();
Expand All @@ -160,6 +183,10 @@ class LargeVideo extends Component<Props> {
if (_isScreenSharing && _seeWhatIsBeingShared) {
VideoLayout.updateLargeVideo(_largeVideoParticipantId, true, true);
}

if (_aloneInTheMeeting && prevProps._hideSelfView !== _hideSelfView) {
VideoLayout.updateLargeVideo(_localParticipantId, true, false);
}
}

/**
Expand Down Expand Up @@ -371,7 +398,10 @@ function _mapStateToProps(state) {
_verticalFilmstripWidth: verticalFilmstripWidth.current,
_verticalViewMaxWidth: getVerticalViewMaxWidth(state),
_visibleFilmstrip: visible,
_whiteboardEnabled: isWhiteboardEnabled(state)
_whiteboardEnabled: isWhiteboardEnabled(state),
_hideSelfView: getHideSelfView(state),
_localParticipantId: localParticipantId,
_aloneInTheMeeting: getParticipantCount(state) === 1
};
}

Expand Down