|
@@ -78,44 +78,44 @@ function computeDesktopVideoSize(videoWidth,
|
78
|
78
|
function computeCameraVideoSize(videoWidth,
|
79
|
79
|
videoHeight,
|
80
|
80
|
videoSpaceWidth,
|
81
|
|
- videoSpaceHeight) {
|
82
|
|
-
|
|
81
|
+ videoSpaceHeight,
|
|
82
|
+ videoLayoutFit) {
|
83
|
83
|
const aspectRatio = videoWidth / videoHeight;
|
84
|
|
- let availableWidth = videoWidth;
|
85
|
|
- let availableHeight = videoHeight;
|
86
|
|
-
|
87
|
|
- if (interfaceConfig.VIDEO_LAYOUT_FIT === 'height') {
|
88
|
|
- availableHeight = videoSpaceHeight;
|
89
|
|
- availableWidth = availableHeight * aspectRatio;
|
90
|
|
- } else if (interfaceConfig.VIDEO_LAYOUT_FIT === 'width') {
|
91
|
|
- availableWidth = videoSpaceWidth;
|
92
|
|
- availableHeight = availableWidth / aspectRatio;
|
93
|
|
- } else if (interfaceConfig.VIDEO_LAYOUT_FIT === 'both') {
|
94
|
|
- availableWidth = Math.max(videoWidth, videoSpaceWidth);
|
95
|
|
- availableHeight = Math.max(videoHeight, videoSpaceHeight);
|
96
|
|
-
|
97
|
|
- if (availableWidth / aspectRatio < videoSpaceHeight) {
|
98
|
|
- availableHeight = videoSpaceHeight;
|
99
|
|
- availableWidth = availableHeight * aspectRatio;
|
|
84
|
+ switch (videoLayoutFit) {
|
|
85
|
+ case 'height':
|
|
86
|
+ return [ videoSpaceHeight * aspectRatio, videoSpaceHeight ];
|
|
87
|
+ case 'width':
|
|
88
|
+ return [ videoSpaceWidth, videoSpaceWidth / aspectRatio ];
|
|
89
|
+ case 'both': {
|
|
90
|
+ const videoSpaceRatio = videoSpaceWidth / videoSpaceHeight;
|
|
91
|
+ const maxZoomCoefficient = interfaceConfig.MAXIMUM_ZOOMING_COEFFICIENT
|
|
92
|
+ || Infinity;
|
|
93
|
+
|
|
94
|
+ if (videoSpaceRatio === aspectRatio) {
|
|
95
|
+ return [videoSpaceWidth, videoSpaceHeight];
|
100
|
96
|
}
|
101
|
97
|
|
102
|
|
- if (aspectRatio <= 1) {
|
103
|
|
- const zoomRateHeight = videoSpaceHeight / videoHeight;
|
104
|
|
- const zoomRateWidth = videoSpaceWidth / videoWidth;
|
105
|
|
- const zoomRate = Math.min(
|
106
|
|
- zoomRateWidth,
|
107
|
|
- zoomRateHeight,
|
108
|
|
- interfaceConfig.MAXIMUM_ZOOMING_COEFFICIENT || Infinity);
|
109
|
|
-
|
110
|
|
- availableWidth = videoWidth * zoomRate;
|
111
|
|
- availableHeight = videoHeight * zoomRate;
|
112
|
|
- } else if (availableHeight * aspectRatio < videoSpaceWidth) {
|
113
|
|
- availableWidth = videoSpaceWidth;
|
114
|
|
- availableHeight = availableWidth / aspectRatio;
|
|
98
|
+ let [ width, height] = computeCameraVideoSize(
|
|
99
|
+ videoWidth,
|
|
100
|
+ videoHeight,
|
|
101
|
+ videoSpaceWidth,
|
|
102
|
+ videoSpaceHeight,
|
|
103
|
+ videoSpaceRatio < aspectRatio ? 'height' : 'width');
|
|
104
|
+ const maxWidth = videoSpaceWidth * maxZoomCoefficient;
|
|
105
|
+ const maxHeight = videoSpaceHeight * maxZoomCoefficient;
|
|
106
|
+
|
|
107
|
+ if (width > maxWidth) {
|
|
108
|
+ width = maxWidth;
|
|
109
|
+ height = width / aspectRatio;
|
|
110
|
+ } else if (height > maxHeight) {
|
|
111
|
+ height = maxHeight;
|
|
112
|
+ width = height * aspectRatio;
|
115
|
113
|
}
|
|
114
|
+ return [width, height];
|
|
115
|
+ }
|
|
116
|
+ default:
|
|
117
|
+ return [ videoWidth, videoHeight ];
|
116
|
118
|
}
|
117
|
|
-
|
118
|
|
- return [ availableWidth, availableHeight ];
|
119
|
119
|
}
|
120
|
120
|
|
121
|
121
|
/**
|
|
@@ -293,7 +293,8 @@ export class VideoContainer extends LargeContainer {
|
293
|
293
|
return computeCameraVideoSize(width,
|
294
|
294
|
height,
|
295
|
295
|
containerWidth,
|
296
|
|
- containerHeight);
|
|
296
|
+ containerHeight,
|
|
297
|
+ interfaceConfig.VIDEO_LAYOUT_FIT);
|
297
|
298
|
}
|
298
|
299
|
|
299
|
300
|
/**
|
|
@@ -355,8 +356,11 @@ export class VideoContainer extends LargeContainer {
|
355
|
356
|
let [ width, height ]
|
356
|
357
|
= this.getVideoSize(containerWidth, containerHeight);
|
357
|
358
|
|
358
|
|
- if (containerWidth > width) {
|
|
359
|
+ if ((containerWidth > width) || (containerHeight > height)) {
|
359
|
360
|
this._showVideoBackground();
|
|
361
|
+ const css = containerWidth > width
|
|
362
|
+ ? {width: '100%', height: 'auto'} : {width: 'auto', height: '100%'};
|
|
363
|
+ this.$videoBackground.css(css);
|
360
|
364
|
}
|
361
|
365
|
|
362
|
366
|
let { horizontalIndent, verticalIndent }
|