Skip to content

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

feat(VideoContainer) add option to avoid cropping focused video

adam j hartz70b369a1af06
diff --git a/interface_config.js b/interface_config.js
index fa9c88343c..fb8dd48569 100644
--- a/interface_config.js
+++ b/interface_config.js
@@ -224,7 +224,8 @@ var interfaceConfig = {
// Determines how the video would fit the screen. 'both' would fit the whole
// screen, 'height' would fit the original video height to the height of the
// screen, 'width' would fit the original video width to the width of the
- // screen respecting ratio.
+ // screen respecting ratio, 'nocrop' would make the video as large as
+ // possible and preserve aspect ratio without cropping.
VIDEO_LAYOUT_FIT: 'both',
/**
diff --git a/modules/UI/videolayout/VideoContainer.js b/modules/UI/videolayout/VideoContainer.js
index 393a9f4530..7752b38f8d 100644
--- a/modules/UI/videolayout/VideoContainer.js
+++ b/modules/UI/videolayout/VideoContainer.js
@@ -98,14 +98,21 @@ function computeCameraVideoSize( // eslint-disable-line max-params
}
const aspectRatio = videoWidth / videoHeight;
+ const videoSpaceRatio = videoSpaceWidth / videoSpaceHeight;
switch (videoLayoutFit) {
case 'height':
return [ videoSpaceHeight * aspectRatio, videoSpaceHeight ];
case 'width':
return [ videoSpaceWidth, videoSpaceWidth / aspectRatio ];
+ case 'nocrop':
+ return computeCameraVideoSize(
+ videoWidth,
+ videoHeight,
+ videoSpaceWidth,
+ videoSpaceHeight,
+ videoSpaceRatio < aspectRatio ? 'width' : 'height');
case 'both': {
- const videoSpaceRatio = videoSpaceWidth / videoSpaceHeight;
const maxZoomCoefficient = interfaceConfig.MAXIMUM_ZOOMING_COEFFICIENT
|| Infinity;