Skip to content

Commit

Permalink
oi
Browse files Browse the repository at this point in the history
  • Loading branch information
TodePond committed Feb 11, 2024
1 parent 262dc72 commit 10b1c96
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,16 @@

const devices = await navigator.mediaDevices.enumerateDevices();

const backCamera = devices.find((device) => {
let backCamera = devices.find((device) => {
const capabilities = device.getCapabilities?.();
if (!capabilities) return false;
return capabilities.facingMode?.includes("environment");
});

if (!backCamera) {
backCamera = devices[0];
}

const stream = await navigator.mediaDevices.getUserMedia({
video: {
deviceId: backCamera.deviceId,
Expand Down

0 comments on commit 10b1c96

Please sign in to comment.