feat(VideoContainer) add option to avoid cropping focused video
This commit is contained in:
parent
cf6d6f8a12
commit
70b369a1af
|
@ -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',
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue