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(dominant-label) Fix dominant speaker stage view label #11071

Merged
merged 1 commit into from
Mar 4, 2022
Merged
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
4 changes: 2 additions & 2 deletions modules/UI/videolayout/LargeVideoManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
isTrackStreamingStatusInactive,
isTrackStreamingStatusInterrupted
} from '../../../react/features/connection-indicator/functions';
import { FILMSTRIP_BREAKPOINT, isFilmstripResizable } from '../../../react/features/filmstrip';
import { FILMSTRIP_BREAKPOINT, isFilmstripResizable, getVerticalViewMaxWidth } from '../../../react/features/filmstrip';
import {
updateKnownLargeVideoResolution
} from '../../../react/features/large-video/actions';
Expand Down Expand Up @@ -419,7 +419,7 @@ export default class LargeVideoManager {
}

if (resizableFilmstrip && visible && filmstripWidth.current >= FILMSTRIP_BREAKPOINT) {
widthToUse -= filmstripWidth.current;
widthToUse -= getVerticalViewMaxWidth(state);
}

this.width = widthToUse;
Expand Down
15 changes: 10 additions & 5 deletions react/features/display-name/components/web/DominantSpeakerName.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,18 @@ const useStyles = makeStyles(theme => {
badgeContainer: {
...withPixelLineHeight(theme.typography.bodyShortRegularLarge),
alignItems: 'center',
display: 'flex',
display: 'inline-flex',
justifyContent: 'center',
marginBottom: theme.spacing(2),
transition: 'margin-bottom 0.3s'
marginBottom: theme.spacing(7),
transition: 'margin-bottom 0.3s',
position: 'absolute',
bottom: 0,
left: 0,
width: '100%',
zIndex: 1
},
containerElevated: {
marginBottom: theme.spacing(7)
marginBottom: theme.spacing(12)
}
};
});
Expand All @@ -50,7 +55,7 @@ const DominantSpeakerName = () => {
if (showDisplayName && nameToDisplay && selectedId !== localId && !isTileView) {
return (
<div
className = { `${classes.badgeContainer}${toolboxVisible ? '' : ` ${classes.containerElevated}`}` }>
className = { `${classes.badgeContainer}${toolboxVisible ? ` ${classes.containerElevated}` : ''}` }>
<DisplayNameBadge name = { nameToDisplay } />
</div>
);
Expand Down
21 changes: 10 additions & 11 deletions react/features/filmstrip/components/web/Filmstrip.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
TOOLBAR_HEIGHT_MOBILE
} from '../../constants';
import {
getVerticalViewMaxWidth,
isFilmstripResizable,
shouldRemoteVideosBeVisible,
showGridInVerticalView
Expand Down Expand Up @@ -152,6 +153,11 @@ type Props = {
*/
_verticalViewGrid: boolean,

/**
* The max width of the vertical filmstrip.
*/
_verticalViewMaxWidth: number,

/**
* Additional CSS class names to add to the container of all the thumbnails.
*/
Expand Down Expand Up @@ -285,23 +291,15 @@ class Filmstrip extends PureComponent <Props, State> {
_verticalFilmstripWidth,
_visible,
_verticalViewGrid,
_verticalViewMaxWidth,
classes
} = this.props;
const { isMouseDown } = this.state;
const tileViewActive = _currentLayout === LAYOUTS.TILE_VIEW;
let maxWidth;

switch (_currentLayout) {
case LAYOUTS.VERTICAL_FILMSTRIP_VIEW:
maxWidth = _resizableFilmstrip
? _verticalFilmstripWidth || DEFAULT_FILMSTRIP_WIDTH
: interfaceConfig.FILM_STRIP_MAX_HEIGHT || DEFAULT_FILMSTRIP_WIDTH;

// Adding 4px for the border-right and margin-right.
// On non-resizable filmstrip add 4px for the left margin and border.
// Also adding 7px for the scrollbar. Also adding 9px for the drag handle.
filmstripStyle.maxWidth = maxWidth + (_verticalViewGrid ? 0 : 11) + (_resizableFilmstrip ? 9 : 4);

filmstripStyle.maxWidth = _verticalViewMaxWidth;
if (!_visible) {
filmstripStyle.right = `-${filmstripStyle.maxWidth}px`;
}
Expand Down Expand Up @@ -850,7 +848,8 @@ function _mapStateToProps(state) {
_verticalFilmstripWidth: verticalFilmstripWidth.current,
_videosClassName: videosClassName,
_visible: visible,
_verticalViewGrid
_verticalViewGrid,
_verticalViewMaxWidth: getVerticalViewMaxWidth(state)
};
}

Expand Down
22 changes: 22 additions & 0 deletions react/features/filmstrip/functions.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,3 +401,25 @@ export function showGridInVerticalView(state) {

return resizableFilmstrip && ((width.current ?? 0) > FILMSTRIP_GRID_BREAKPOINT);
}

/**
* Gets the vertical filmstrip max width.
*
* @param {Object} state - Redux state.
* @returns {number}
*/
export function getVerticalViewMaxWidth(state) {
const { width } = state['features/filmstrip'];
const _resizableFilmstrip = isFilmstripResizable(state);
const _verticalViewGrid = showGridInVerticalView(state);
let maxWidth = _resizableFilmstrip
? width.current || DEFAULT_FILMSTRIP_WIDTH
: interfaceConfig.FILM_STRIP_MAX_HEIGHT || DEFAULT_FILMSTRIP_WIDTH;

// Adding 4px for the border-right and margin-right.
// On non-resizable filmstrip add 4px for the left margin and border.
// Also adding 7px for the scrollbar. Also adding 9px for the drag handle.
maxWidth += (_verticalViewGrid ? 0 : 11) + (_resizableFilmstrip ? 9 : 4);

return maxWidth;
}
22 changes: 20 additions & 2 deletions react/features/large-video/components/LargeVideo.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import VideoLayout from '../../../../modules/UI/videolayout/VideoLayout';
import { Watermarks } from '../../base/react';
import { connect } from '../../base/redux';
import { setColorAlpha } from '../../base/util';
import { DominantSpeakerName } from '../../display-name';
import { FILMSTRIP_BREAKPOINT, isFilmstripResizable } from '../../filmstrip';
import { getVerticalViewMaxWidth } from '../../filmstrip/functions.web';
import { SharedVideo } from '../../shared-video/components/web';
import { Captions } from '../../subtitles/';
import { setTileView } from '../../video-layout/actions';
Expand Down Expand Up @@ -46,11 +48,21 @@ type Props = {
*/
_resizableFilmstrip: boolean,

/**
* Whether or not to show dominant speaker badge.
*/
_showDominantSpeakerBadge: boolean,

/**
* The width of the vertical filmstrip (user resized).
*/
_verticalFilmstripWidth: ?number,

/**
* The max width of the vertical filmstrip.
*/
_verticalViewMaxWidth: number,

/**
* Whether or not the filmstrip is visible.
*/
Expand Down Expand Up @@ -113,7 +125,8 @@ class LargeVideo extends Component<Props> {
render() {
const {
_isChatOpen,
_noAutoPlayVideo
_noAutoPlayVideo,
_showDominantSpeakerBadge
} = this.props;
const style = this._getCustomSyles();
const className = `videocontainer${_isChatOpen ? ' shift-right' : ''}`;
Expand Down Expand Up @@ -162,6 +175,7 @@ class LargeVideo extends Component<Props> {
</div>
{ interfaceConfig.DISABLE_TRANSCRIPTION_SUBTITLES
|| <Captions /> }
{_showDominantSpeakerBadge && <DominantSpeakerName />}
</div>
);
}
Expand Down Expand Up @@ -217,6 +231,7 @@ class LargeVideo extends Component<Props> {
_customBackgroundColor,
_customBackgroundImageUrl,
_verticalFilmstripWidth,
_verticalViewMaxWidth,
_visibleFilmstrip
} = this.props;

Expand All @@ -234,7 +249,7 @@ class LargeVideo extends Component<Props> {
}

if (_visibleFilmstrip && _verticalFilmstripWidth >= FILMSTRIP_BREAKPOINT) {
styles.width = `calc(100% - ${_verticalFilmstripWidth || 0}px)`;
styles.width = `calc(100% - ${_verticalViewMaxWidth || 0}px)`;
}

return styles;
Expand Down Expand Up @@ -275,6 +290,7 @@ function _mapStateToProps(state) {
const { backgroundColor, backgroundImageUrl } = state['features/dynamic-branding'];
const { isOpen: isChatOpen } = state['features/chat'];
const { width: verticalFilmstripWidth, visible } = state['features/filmstrip'];
const { hideDominantSpeakerBadge } = state['features/base/config'];

return {
_backgroundAlpha: state['features/base/config'].backgroundAlpha,
Expand All @@ -283,7 +299,9 @@ function _mapStateToProps(state) {
_isChatOpen: isChatOpen,
_noAutoPlayVideo: testingConfig?.noAutoPlayVideo,
_resizableFilmstrip: isFilmstripResizable(state),
_showDominantSpeakerBadge: !hideDominantSpeakerBadge,
_verticalFilmstripWidth: verticalFilmstripWidth.current,
_verticalViewMaxWidth: getVerticalViewMaxWidth(state),
_visibleFilmstrip: visible
};
}
Expand Down
11 changes: 0 additions & 11 deletions react/features/toolbox/components/web/Toolbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import { connect } from '../../../base/redux';
import { getLocalVideoTrack } from '../../../base/tracks';
import { toggleChat } from '../../../chat';
import { ChatButton } from '../../../chat/components';
import { DominantSpeakerName } from '../../../display-name';
import { EmbedMeetingButton } from '../../../embed-meeting';
import { SharedDocumentButton } from '../../../etherpad';
import { FeedbackButton } from '../../../feedback';
Expand Down Expand Up @@ -225,11 +224,6 @@ type Props = {
*/
_sharingVideo: boolean,

/**
* Whether or not to show dominant speaker badge.
*/
_showDominantSpeakerBadge: boolean,

/**
* Whether or not the tile view is enabled.
*/
Expand Down Expand Up @@ -1267,7 +1261,6 @@ class Toolbox extends Component<Props> {
_overflowMenuVisible,
_reactionsEnabled,
_toolbarButtons,
_showDominantSpeakerBadge,
classes,
t
} = this.props;
Expand All @@ -1287,8 +1280,6 @@ class Toolbox extends Component<Props> {
onMouseOver: this._onMouseOver
}) }>

{ _showDominantSpeakerBadge && <DominantSpeakerName /> }

<div className = 'toolbox-content-items'>
{mainMenuButtons.map(({ Content, key, ...rest }) => Content !== Separator && (
<Content
Expand Down Expand Up @@ -1359,7 +1350,6 @@ function _mapStateToProps(state, ownProps) {
callStatsID,
disableProfile,
enableFeaturesBasedOnToken,
hideDominantSpeakerBadge,
iAmRecorder,
iAmSipGateway
} = state['features/base/config'];
Expand Down Expand Up @@ -1417,7 +1407,6 @@ function _mapStateToProps(state, ownProps) {
_raisedHand: hasRaisedHand(localParticipant),
_reactionsEnabled: isReactionsEnabled(state),
_screenSharing: isScreenVideoShared(state),
_showDominantSpeakerBadge: !hideDominantSpeakerBadge,
_tileViewEnabled: shouldDisplayTileView(state),
_toolbarButtons: toolbarButtons,
_virtualSource: state['features/virtual-background'].virtualSource,
Expand Down