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', 'recording', 'security', 'invite', 'chat', 'prezi', 'etherpad',
'fullscreen', 'sip', 'dialpad', 'settings', 'hangup', 'filmstrip', 'fullscreen', 'sip', 'dialpad', 'settings', 'hangup', 'filmstrip',
'contacts'], 'contacts'],
VIDEO_LAYOUT_FIT: 'both', // height, width, both
/** /**
* Whether to only show the filmstrip (and hide the toolbar). * Whether to only show the filmstrip (and hide the toolbar).
*/ */

View File

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