QrScanner.tsx
async function handleRequestCameraPermissions() {
try {
const stream = await navigator.mediaDevices.getUserMedia({
video: true,
});
if (videoRef.current) {
videoRef.current.srcObject = stream;
videoRef.current.play();
setScanning(true);
videoRef.current.addEventListener("loadedmetadata", () => {
scanQRCode();
});
}
} catch (error) {
if (error.name === "NotAllowedError" || error.name === "NotFoundError") {
// Handle camera permission denial or absence
requestCameraPermission();
} else {
// Handle other errors
toast.error(t("errors.allow_camera_access"));
}
}
}
desktop firefox:
addon context - works
website context - works
firefox android:
addon context - doesn’t work
website context - works : https://blog.minhazav.dev/research/html5-qrcode