From 2ad6fc5b6e44cbcd4b7019ed33849825387e95cd Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Sat, 4 Nov 2023 23:56:47 +0100 Subject: [PATCH] Constrain video aspect ratio rather than resolution. --- static/galene.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/static/galene.js b/static/galene.js index 38aa29d..309f2bf 100644 --- a/static/galene.js +++ b/static/galene.js @@ -1391,7 +1391,9 @@ function replaceCameraStream() { async function addLocalMedia(localId) { let settings = getSettings(); + /** @type{boolean|MediaTrackConstraints} */ let audio = settings.audio ? {deviceId: settings.audio} : false; + /** @type{boolean|MediaTrackConstraints} */ let video = settings.video ? {deviceId: settings.video} : false; if(video) { @@ -1403,8 +1405,7 @@ async function addLocalMedia(localId) { video.width = { min: 640, ideal: 1920 }; video.height = { min: 400, ideal: 1080 }; } else { - video.width = { ideal: 640 }; - video.height = { ideal: 400 }; + video.aspectRatio = { ideal: 4/3 }; } }