diff --git a/interface_config.js b/interface_config.js index 4de946ad1..afe7578de 100644 --- a/interface_config.js +++ b/interface_config.js @@ -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). */ diff --git a/modules/UI/videolayout/LargeVideo.js b/modules/UI/videolayout/LargeVideo.js index 7ae38f178..78feb1252 100644 --- a/modules/UI/videolayout/LargeVideo.js +++ b/modules/UI/videolayout/LargeVideo.js @@ -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]; }