ui: Select environment camera if possible

Apparently, Firefox/Android defaults to using the front camera, and
does not provide any native UI for selecting a different one.  We can
request the back camera by indiciting that the "environment" camera is
"ideal."
bugfix/ci-buildah
Dustin 2025-03-08 20:10:50 -06:00
parent cdf50c159c
commit 2d7ff417fc
1 changed files with 5 additions and 1 deletions

View File

@ -57,7 +57,11 @@ async function startCamera() {
let stream: MediaStream; let stream: MediaStream;
try { try {
stream = await navigator.mediaDevices.getUserMedia({ stream = await navigator.mediaDevices.getUserMedia({
video: true, video: {
facingMode: {
ideal: "environment",
},
},
audio: false, audio: false,
}); });
} catch (ex) { } catch (ex) {