Skip to content

Commit 3ea4b9d

Browse files
committed
Fix issues preventing use on Firefox
1 parent 88e5845 commit 3ea4b9d

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,14 +312,14 @@
312312
document.getElementById("mesh-draw-time-max").innerText = meshRendererStats.getMaximum().toFixed(2).toString();
313313
}, 100);
314314

315-
const warmupInterval = setInterval(() => {
315+
const warmupInterval = setInterval(async () => {
316316
if (bodyDetector.isReady() && faceDetector.isReady() && handDetector.isReady()) {
317317
clearInterval(warmupInterval);
318318

319319
document.getElementById("body-detector-ready").innerText = "True";
320320
document.getElementById("face-detector-ready").innerText = "True";
321321
document.getElementById("hand-detector-ready").innerText = "True";
322-
document.getElementById("video-input-device-select").disabled = false;
322+
(await Camera.getSelectElement()).disabled = false;
323323
}
324324
}, 100);
325325

js/camera.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,12 @@ export class Camera {
8989
}
9090

9191
// Automatically update the select element when the camera permissions are changed.
92-
const cameraPermissionStatus = await navigator.permissions.query({ name: "camera" });
93-
cameraPermissionStatus.onchange = async () => await Camera.updateSelectElement();
92+
try {
93+
const cameraPermissionStatus = await navigator.permissions.query({name: "camera"});
94+
cameraPermissionStatus.onchange = async () => await Camera.updateSelectElement();
95+
} catch (e) {
96+
// The browser does not support the Permissions API.
97+
}
9498

9599
// Automatically update the select element when the set of available devices changes.
96100
// todo Test this.

0 commit comments

Comments
 (0)