Skip to content

Commit

Permalink
Fix issues preventing use on Firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
Valkryst committed Dec 5, 2023
1 parent 88e5845 commit 3ea4b9d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -312,14 +312,14 @@
document.getElementById("mesh-draw-time-max").innerText = meshRendererStats.getMaximum().toFixed(2).toString();
}, 100);

const warmupInterval = setInterval(() => {
const warmupInterval = setInterval(async () => {
if (bodyDetector.isReady() && faceDetector.isReady() && handDetector.isReady()) {
clearInterval(warmupInterval);

document.getElementById("body-detector-ready").innerText = "True";
document.getElementById("face-detector-ready").innerText = "True";
document.getElementById("hand-detector-ready").innerText = "True";
document.getElementById("video-input-device-select").disabled = false;
(await Camera.getSelectElement()).disabled = false;
}
}, 100);

Expand Down
8 changes: 6 additions & 2 deletions js/camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,12 @@ export class Camera {
}

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

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

0 comments on commit 3ea4b9d

Please sign in to comment.