From 1793bf460e24591f9e945c2e2294c37cab5f5fb5 Mon Sep 17 00:00:00 2001 From: Avram Tudor Date: Tue, 26 Oct 2021 11:46:01 +0300 Subject: [PATCH] fix(tileview) Enlarge tiles to fill whole space (#10201) --- .../filmstrip/components/web/Thumbnail.js | 45 ++++++++++++++----- react/features/filmstrip/functions.web.js | 4 +- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/react/features/filmstrip/components/web/Thumbnail.js b/react/features/filmstrip/components/web/Thumbnail.js index 3d90285b3..6a83069f5 100644 --- a/react/features/filmstrip/components/web/Thumbnail.js +++ b/react/features/filmstrip/components/web/Thumbnail.js @@ -509,13 +509,26 @@ class Thumbnail extends Component { * @returns {Object} - The styles for the thumbnail. */ _getStyles(): Object { - const { _height, _isHidden, _width, style, horizontalOffset } = this.props; + + const { canPlayEventReceived } = this.state; + const { + _height, + _isHidden, + _isScreenSharing, + _participant, + _width, + horizontalOffset, + style + } = this.props; + let styles: { + avatar: Object, thumbnail: Object, - avatar: Object + video: Object } = { thumbnail: {}, - avatar: {} + avatar: {}, + video: {} }; const avatarSize = _height / 2; @@ -525,6 +538,20 @@ class Thumbnail extends Component { left += horizontalOffset; } + let videoStyles = null; + + if (!_isScreenSharing) { + if (canPlayEventReceived || _participant.local) { + videoStyles = { + objectFit: _height > 320 ? 'cover' : 'contain' + }; + } else { + videoStyles = { + display: 'none' + }; + } + } + styles = { thumbnail: { ...style, @@ -537,7 +564,8 @@ class Thumbnail extends Component { avatar: { height: `${avatarSize}px`, width: `${avatarSize}px` - } + }, + video: videoStyles }; if (_isHidden) { @@ -836,6 +864,7 @@ class Thumbnail extends Component {
@@ -934,7 +963,7 @@ class Thumbnail extends Component { _volume = 1 } = this.props; const { id } = _participant; - const { audioLevel, canPlayEventReceived } = this.state; + const { audioLevel } = this.state; const styles = this._getStyles(); const containerClassName = this._getContainerClassName(); @@ -952,10 +981,6 @@ class Thumbnail extends Component { videoEventListeners.onCanPlay = this._onCanPlay; - const videoElementStyle = canPlayEventReceived ? null : { - display: 'none' - }; - return ( { eventHandlers = { videoEventListeners } id = { `remoteVideo_${videoTrackId || ''}` } muted = { true } - style = { videoElementStyle } + style = { styles.video } videoTrack = { _videoTrack } /> }
diff --git a/react/features/filmstrip/functions.web.js b/react/features/filmstrip/functions.web.js index 7d39d83b5..d0c9ab757 100644 --- a/react/features/filmstrip/functions.web.js +++ b/react/features/filmstrip/functions.web.js @@ -215,8 +215,8 @@ export function calculateThumbnailSizeForTileView({ return { - height, - width + height: initialHeight, + width: initialWidth }; }