diff --git a/css/styles.css b/css/styles.css index 3693da9..43452d3 100644 --- a/css/styles.css +++ b/css/styles.css @@ -22,8 +22,8 @@ table, th, td { #jellron-display { margin: 0 auto; - height: 600px; - width: 800px; + height: 800px; + width: 50%; & > canvas, & > video { position: absolute; diff --git a/js/camera.js b/js/camera.js index 0bca072..716e805 100644 --- a/js/camera.js +++ b/js/camera.js @@ -121,7 +121,11 @@ export class Camera { } this.videoElement.srcObject = await this.getVideoInputDevice(); - this.videoElement.height = this.jellronDisplay.scrollHeight; + + const aspectRatio = await this.getMediaStreamWidth() / await this.getMediaStreamHeight(); + this.videoElement.parentElement.style.aspectRatio = aspectRatio; + this.videoElement.style.aspectRatio = aspectRatio; + this.videoElement.width = this.jellronDisplay.scrollWidth; }