Makes video screen fit configurable.

This commit is contained in:
Yana Stamcheva 2015-10-06 10:41:46 -05:00 committed by yanas
parent e0ba0c8085
commit 8a678286f7
2 changed files with 24 additions and 8 deletions

View File

@ -20,6 +20,7 @@ var interfaceConfig = {
'recording', 'security', 'invite', 'chat', 'prezi', 'etherpad',
'fullscreen', 'sip', 'dialpad', 'settings', 'hangup', 'filmstrip',
'contacts'],
VIDEO_LAYOUT_FIT: 'both', // height, width, both
/**
* Whether to only show the filmstrip (and hide the toolbar).
*/

View File

@ -189,6 +189,7 @@ function getCameraVideoSize(videoWidth,
videoHeight,
videoSpaceWidth,
videoSpaceHeight) {
if (!videoWidth)
videoWidth = currentVideoWidth;
if (!videoHeight)
@ -196,18 +197,32 @@ function getCameraVideoSize(videoWidth,
var aspectRatio = videoWidth / videoHeight;
var availableWidth = Math.max(videoWidth, videoSpaceWidth);
var availableHeight = Math.max(videoHeight, videoSpaceHeight);
var availableWidth = videoWidth;
var availableHeight = videoHeight;
if (availableWidth / aspectRatio < videoSpaceHeight) {
if (interfaceConfig.VIDEO_LAYOUT_FIT == 'height') {
availableHeight = videoSpaceHeight;
availableWidth = availableHeight * aspectRatio;
availableWidth = availableHeight*aspectRatio;
}
else if (interfaceConfig.VIDEO_LAYOUT_FIT == 'width') {
availableWidth = videoSpaceWidth;
availableHeight = availableWidth/aspectRatio;
}
else if (interfaceConfig.VIDEO_LAYOUT_FIT == 'both') {
availableWidth = Math.max(videoWidth, videoSpaceWidth);
availableHeight = Math.max(videoHeight, videoSpaceHeight);
if (availableWidth / aspectRatio < videoSpaceHeight) {
availableHeight = videoSpaceHeight;
availableWidth = availableHeight * aspectRatio;
}
if (availableHeight * aspectRatio < videoSpaceWidth) {
availableWidth = videoSpaceWidth;
availableHeight = availableWidth / aspectRatio;
}
}
if (availableHeight * aspectRatio < videoSpaceWidth) {
availableWidth = videoSpaceWidth;
availableHeight = availableWidth / aspectRatio;
}
return [availableWidth, availableHeight];
}