Browse Source

feat(VideoContainer) add option to avoid cropping focused video

master
adam j hartz 3 years ago
parent
commit
70b369a1af
No account linked to committer's email address
2 changed files with 10 additions and 2 deletions
  1. 2
    1
      interface_config.js
  2. 8
    1
      modules/UI/videolayout/VideoContainer.js

+ 2
- 1
interface_config.js View File

@@ -224,7 +224,8 @@ var interfaceConfig = {
224 224
     // Determines how the video would fit the screen. 'both' would fit the whole
225 225
     // screen, 'height' would fit the original video height to the height of the
226 226
     // screen, 'width' would fit the original video width to the width of the
227
-    // screen respecting ratio.
227
+    // screen respecting ratio, 'nocrop' would make the video as large as
228
+    // possible and preserve aspect ratio without cropping.
228 229
     VIDEO_LAYOUT_FIT: 'both',
229 230
 
230 231
     /**

+ 8
- 1
modules/UI/videolayout/VideoContainer.js View File

@@ -98,14 +98,21 @@ function computeCameraVideoSize( // eslint-disable-line max-params
98 98
     }
99 99
 
100 100
     const aspectRatio = videoWidth / videoHeight;
101
+    const videoSpaceRatio = videoSpaceWidth / videoSpaceHeight;
101 102
 
102 103
     switch (videoLayoutFit) {
103 104
     case 'height':
104 105
         return [ videoSpaceHeight * aspectRatio, videoSpaceHeight ];
105 106
     case 'width':
106 107
         return [ videoSpaceWidth, videoSpaceWidth / aspectRatio ];
108
+    case 'nocrop':
109
+        return computeCameraVideoSize(
110
+            videoWidth,
111
+            videoHeight,
112
+            videoSpaceWidth,
113
+            videoSpaceHeight,
114
+            videoSpaceRatio < aspectRatio ? 'width' : 'height');
107 115
     case 'both': {
108
-        const videoSpaceRatio = videoSpaceWidth / videoSpaceHeight;
109 116
         const maxZoomCoefficient = interfaceConfig.MAXIMUM_ZOOMING_COEFFICIENT
110 117
             || Infinity;
111 118
 

Loading…
Cancel
Save