Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(thumbnail) Update tile resizing constraints (#10645)

Robert Pintiliid44660527be3
diff --git a/css/_base.scss b/css/_base.scss
index 67ad368b7e..d3b6a5a00d 100644
--- a/css/_base.scss
+++ b/css/_base.scss
@@ -6,6 +6,10 @@
* {
-webkit-user-select: none;
user-select: none;
+
+ // Firefox only
+ scrollbar-width: thin;
+ scrollbar-color: rgba(0, 0, 0, .5) transparent;
}
input,
diff --git a/react/features/filmstrip/actions.web.js b/react/features/filmstrip/actions.web.js
index 65096ee41d..079cc6c52f 100644
--- a/react/features/filmstrip/actions.web.js
+++ b/react/features/filmstrip/actions.web.js
@@ -39,7 +39,7 @@ export function setTileViewDimensions(dimensions: Object) {
return (dispatch: Dispatch<any>, getState: Function) => {
const state = getState();
const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
- const { disableResponsiveTiles } = state['features/base/config'];
+ const { disableResponsiveTiles, disableTileEnlargement } = state['features/base/config'];
const {
height,
width
@@ -47,7 +47,8 @@ export function setTileViewDimensions(dimensions: Object) {
...dimensions,
clientWidth,
clientHeight,
- disableResponsiveTiles
+ disableResponsiveTiles,
+ disableTileEnlargement
});
const { columns, rows } = dimensions;
const thumbnailsTotalHeight = rows * (TILE_VERTICAL_MARGIN + height);
diff --git a/react/features/filmstrip/components/web/Thumbnail.js b/react/features/filmstrip/components/web/Thumbnail.js
index 241db06dfa..792d3f8485 100644
--- a/react/features/filmstrip/components/web/Thumbnail.js
+++ b/react/features/filmstrip/components/web/Thumbnail.js
@@ -469,12 +469,17 @@ class Thumbnail extends Component<Props, State> {
_isHidden,
_isScreenSharing,
_participant,
+ _videoTrack,
_width,
horizontalOffset,
style
} = this.props;
+
const tileViewActive = _currentLayout === LAYOUTS.TILE_VIEW;
+ const jitsiVideoTrack = _videoTrack?.jitsiTrack;
+ const track = jitsiVideoTrack?.track;
+ const isPortraitVideo = ((track && track.getSettings()?.aspectRatio) || 1) < 1;
let styles: {
avatar: Object,
@@ -494,7 +499,7 @@ class Thumbnail extends Component<Props, State> {
}
let videoStyles = null;
- const doNotStretchVideo = (_height < 320 && tileViewActive)
+ const doNotStretchVideo = (isPortraitVideo && tileViewActive)
|| _disableTileEnlargement
|| _isScreenSharing;
diff --git a/react/features/filmstrip/constants.js b/react/features/filmstrip/constants.js
index 32950ae6ec..66c9ec65ca 100644
--- a/react/features/filmstrip/constants.js
+++ b/react/features/filmstrip/constants.js
@@ -46,6 +46,21 @@ export const TWO_COLUMN_BREAKPOINT = 1000;
*/
export const ASPECT_RATIO_BREAKPOINT = 500;
+/**
+ * Minimum height of tile for small screens.
+ */
+export const TILE_MIN_HEIGHT_SMALL = 150;
+
+/**
+ * Minimum height of tile for large screens.
+ */
+export const TILE_MIN_HEIGHT_LARGE = 200;
+
+/**
+ * Aspect ratio for portrait tiles. (height / width).
+ */
+export const TILE_PORTRAIT_ASPECT_RATIO = 1.3;
+
/**
* The default number of columns for tile view.
*/
diff --git a/react/features/filmstrip/functions.web.js b/react/features/filmstrip/functions.web.js
index 1398ec7e71..63fdb24372 100644
--- a/react/features/filmstrip/functions.web.js
+++ b/react/features/filmstrip/functions.web.js
@@ -30,7 +30,10 @@ import {
TILE_VERTICAL_MARGIN,
TILE_VIEW_GRID_HORIZONTAL_MARGIN,
TILE_VIEW_GRID_VERTICAL_MARGIN,
- VERTICAL_FILMSTRIP_MIN_HORIZONTAL_MARGIN
+ VERTICAL_FILMSTRIP_MIN_HORIZONTAL_MARGIN,
+ TILE_MIN_HEIGHT_LARGE,
+ TILE_MIN_HEIGHT_SMALL,
+ TILE_PORTRAIT_ASPECT_RATIO
} from './constants';
export * from './functions.any';
@@ -183,7 +186,8 @@ export function calculateThumbnailSizeForTileView({
rows,
clientWidth,
clientHeight,
- disableResponsiveTiles
+ disableResponsiveTiles,
+ disableTileEnlargement
}: Object) {
let aspectRatio = TILE_ASPECT_RATIO;
@@ -191,6 +195,7 @@ export function calculateThumbnailSizeForTileView({
aspectRatio = SQUARE_TILE_ASPECT_RATIO;
}
+ const minHeight = clientWidth < ASPECT_RATIO_BREAKPOINT ? TILE_MIN_HEIGHT_SMALL : TILE_MIN_HEIGHT_LARGE;
const viewWidth = clientWidth - (columns * TILE_HORIZONTAL_MARGIN) - TILE_VIEW_GRID_HORIZONTAL_MARGIN;
const viewHeight = clientHeight - (minVisibleRows * TILE_VERTICAL_MARGIN) - TILE_VIEW_GRID_VERTICAL_MARGIN;
const initialWidth = viewWidth / columns;
@@ -212,13 +217,54 @@ export function calculateThumbnailSizeForTileView({
// window.
height = Math.floor(Math.max(Math.min(scrollAspectRatioHeight, initialHeight), noScrollHeight));
width = Math.floor(aspectRatio * height);
+
+ return {
+ height,
+ width
+ };
+ }
+
+ if (disableTileEnlargement) {
+ return {
+ height,
+ width
+ };
+ }
+
+ if (initialHeight > noScrollHeight) {
+ height = Math.max(height, viewHeight / rows, minHeight);
+ width = Math.max(width, initialWidth);
+ } else {
+ height = Math.max(initialHeight, minHeight);
+ width = initialWidth;
}
+ if (height > width) {
+ const heightFromWidth = TILE_PORTRAIT_ASPECT_RATIO * width;
+
+ if (height > heightFromWidth && heightFromWidth < minHeight) {
+ return {
+ height,
+ width: height / TILE_PORTRAIT_ASPECT_RATIO
+ };
+ }
+
+ return {
+ height: Math.min(height, heightFromWidth),
+ width
+ };
+ } else if (height < width) {
+ return {
+ height,
+ width: Math.min(width, aspectRatio * height)
+ };
+ }
return {
- height: initialHeight,
- width: initialWidth
+ height,
+ width
};
+
}
/**