|
@@ -38,7 +38,7 @@ function getStreamOwnerId(stream) {
|
38
|
38
|
* @param videoSpaceHeight the height of the available space
|
39
|
39
|
* @return an array with 2 elements, the video width and the video height
|
40
|
40
|
*/
|
41
|
|
-function getDesktopVideoSize(videoWidth,
|
|
41
|
+function computeDesktopVideoSize(videoWidth,
|
42
|
42
|
videoHeight,
|
43
|
43
|
videoSpaceWidth,
|
44
|
44
|
videoSpaceHeight) {
|
|
@@ -75,25 +75,22 @@ function getDesktopVideoSize(videoWidth,
|
75
|
75
|
* @param videoSpaceHeight the height of the video space
|
76
|
76
|
* @return an array with 2 elements, the video width and the video height
|
77
|
77
|
*/
|
78
|
|
-function getCameraVideoSize(videoWidth,
|
|
78
|
+function computeCameraVideoSize(videoWidth,
|
79
|
79
|
videoHeight,
|
80
|
80
|
videoSpaceWidth,
|
81
|
81
|
videoSpaceHeight) {
|
82
|
82
|
|
83
|
|
- let aspectRatio = videoWidth / videoHeight;
|
84
|
|
-
|
|
83
|
+ const aspectRatio = videoWidth / videoHeight;
|
85
|
84
|
let availableWidth = videoWidth;
|
86
|
85
|
let availableHeight = videoHeight;
|
87
|
86
|
|
88
|
|
- if (interfaceConfig.VIDEO_LAYOUT_FIT == 'height') {
|
|
87
|
+ if (interfaceConfig.VIDEO_LAYOUT_FIT === 'height') {
|
89
|
88
|
availableHeight = videoSpaceHeight;
|
90
|
|
- availableWidth = availableHeight*aspectRatio;
|
91
|
|
- }
|
92
|
|
- else if (interfaceConfig.VIDEO_LAYOUT_FIT == 'width') {
|
|
89
|
+ availableWidth = availableHeight * aspectRatio;
|
|
90
|
+ } else if (interfaceConfig.VIDEO_LAYOUT_FIT === 'width') {
|
93
|
91
|
availableWidth = videoSpaceWidth;
|
94
|
|
- availableHeight = availableWidth/aspectRatio;
|
95
|
|
- }
|
96
|
|
- else if (interfaceConfig.VIDEO_LAYOUT_FIT == 'both') {
|
|
92
|
+ availableHeight = availableWidth / aspectRatio;
|
|
93
|
+ } else if (interfaceConfig.VIDEO_LAYOUT_FIT === 'both') {
|
97
|
94
|
availableWidth = Math.max(videoWidth, videoSpaceWidth);
|
98
|
95
|
availableHeight = Math.max(videoHeight, videoSpaceHeight);
|
99
|
96
|
|
|
@@ -102,13 +99,22 @@ function getCameraVideoSize(videoWidth,
|
102
|
99
|
availableWidth = availableHeight * aspectRatio;
|
103
|
100
|
}
|
104
|
101
|
|
105
|
|
- if (availableHeight * aspectRatio < videoSpaceWidth) {
|
|
102
|
+ if (aspectRatio <= 1) {
|
|
103
|
+ const zoomRateHeight = videoSpaceHeight / videoHeight;
|
|
104
|
+ const zoomRateWidth = videoSpaceWidth / videoWidth;
|
|
105
|
+ const maxZoomRate
|
|
106
|
+ = interfaceConfig.MAXIMUM_ZOOMING_COEFFICIENT || Infinity;
|
|
107
|
+ let zoomRate = Math.min(zoomRateWidth, maxZoomRate);
|
|
108
|
+
|
|
109
|
+ zoomRate = Math.max(zoomRate, zoomRateHeight);
|
|
110
|
+ availableWidth = videoWidth * zoomRate;
|
|
111
|
+ availableHeight = videoHeight * zoomRate;
|
|
112
|
+ } else if (availableHeight * aspectRatio < videoSpaceWidth) {
|
106
|
113
|
availableWidth = videoSpaceWidth;
|
107
|
114
|
availableHeight = availableWidth / aspectRatio;
|
108
|
115
|
}
|
109
|
116
|
}
|
110
|
117
|
|
111
|
|
-
|
112
|
118
|
return [ availableWidth, availableHeight ];
|
113
|
119
|
}
|
114
|
120
|
|
|
@@ -269,19 +275,20 @@ export class VideoContainer extends LargeContainer {
|
269
|
275
|
* @param {number} containerHeight container height
|
270
|
276
|
* @returns {{availableWidth, availableHeight}}
|
271
|
277
|
*/
|
272
|
|
- getVideoSize (containerWidth, containerHeight) {
|
|
278
|
+ getVideoSize(containerWidth, containerHeight) {
|
273
|
279
|
let { width, height } = this.getStreamSize();
|
|
280
|
+
|
274
|
281
|
if (this.stream && this.isScreenSharing()) {
|
275
|
|
- return getDesktopVideoSize( width,
|
276
|
|
- height,
|
277
|
|
- containerWidth,
|
278
|
|
- containerHeight);
|
279
|
|
- } else {
|
280
|
|
- return getCameraVideoSize( width,
|
|
282
|
+ return computeDesktopVideoSize(width,
|
281
|
283
|
height,
|
282
|
284
|
containerWidth,
|
283
|
285
|
containerHeight);
|
284
|
286
|
}
|
|
287
|
+
|
|
288
|
+ return computeCameraVideoSize(width,
|
|
289
|
+ height,
|
|
290
|
+ containerWidth,
|
|
291
|
+ containerHeight);
|
285
|
292
|
}
|
286
|
293
|
|
287
|
294
|
/**
|