From 2d7ff417fcd93413262284555e3e5f4341bb27c9 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Sat, 8 Mar 2025 20:10:50 -0600 Subject: [PATCH] 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." --- js/transaction.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/transaction.ts b/js/transaction.ts index ef09ed7..c373dab 100644 --- a/js/transaction.ts +++ b/js/transaction.ts @@ -57,7 +57,11 @@ async function startCamera() { let stream: MediaStream; try { stream = await navigator.mediaDevices.getUserMedia({ - video: true, + video: { + facingMode: { + ideal: "environment", + }, + }, audio: false, }); } catch (ex) {