From 5234c42e9ed158020ced9b0977448b8397fbbb8a Mon Sep 17 00:00:00 2001 From: Aidan Campbell Date: Tue, 16 Feb 2016 18:44:54 -0500 Subject: [PATCH] stream size is adapted to aspect ratio. This closes #2 --- static/js/index.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/static/js/index.js b/static/js/index.js index b73586e..2ee5e12 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -73,9 +73,19 @@ function playGameMode() { } function fullscreenNaclModule() { + var streamWidth = 1280; // TODO: once stream size is selectable, use those variables + var streamHeight = 720; + var screenWidth = window.innerWidth; + var screenHeight = window.innerHeight; + + var xRatio = screenWidth / streamWidth; + var yRatio = screenHeight / streamHeight; + + var zoom = Math.min(xRatio, yRatio); + var body = document.getElementById("nacl_module"); - body.width=window.innerWidth; - body.height=window.innerHeight; + body.width=zoom * streamWidth; + body.height=zoom * streamHeight; } // user pushed the stop button. we should stop.