-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Amplify Liveness intermitently does not ask for Camera Permission on FireFox mobile (iOS & Android) #5847
Comments
@paternina What version of Firefox mobile are you using and what's your OS version? |
Is Firefox Mobile 130.0.1 and we used iOS 18 but we have the same behavior in Android 13 |
When you say FireFox Mobile, you mean Firefox for iOS and Firefox for Android, right? |
That's right |
What version of the ui-react-liveness package are you using? |
We have the following: "@aws-amplify/ui-react": "^6.5.1", |
Hi @Tyg0th, Any other patterns of when this happens you can think of that might help us narrow this down? |
@Tyg0th are you using |
Hi @reesscot it fails intermittently sometimes ask for permissions and sometimes it does not, the only difference from our code and the one shared in the documentation is that we are using a check camera utility function before showing the component useEffect(() => {
const checkCamera = async () => {
const cameraExist = await detectWebcam();
setDeviceHasCamera(cameraExist); // if false show an error message and does not load the component
};
checkCamera();
}, []); This is just a JavaScript function that check if customer have a camera. export const detectWebcam = async () => {
let md = navigator.mediaDevices;
if (!md || !md.enumerateDevices){
return false;
}
try {
const devices = await md.enumerateDevices();
return devices.some(device => device.kind === "videoinput");
} catch (error) {
console.error('Error enumerating devices: ', error);
return false;
}
}; It may responde your question @esauerbo , we are using As you may noticed, the FaceLivenessDetector component is loaded and is always showing the waitingCameraPermissionText script. |
@paternina just for reference, we perform a similar check in the component to make sure that a customer has a valid video devices - https://github.com/aws-amplify/amplify-ui/blob/main/packages/react-liveness/src/components/FaceLivenessDetector/service/machine/machine.ts#L961 However we also have a simple check for virtual cameras as the Rekognition services want to avoid the usage of virtual cameras when possible to help avoid fraud. |
Hi @thaddmt Thank you for the reference! I’d like to clarify my understanding: it seems that this implementation only checks if the user has a virtual camera device and then throws an error. The error returned should be handled by the Additionally, please note that the FaceLivenessDetector component is being displayed but is always showing the "waiting for camera permission" text, so I am not sure if the issue is related to the To provide more context, the main issue we're encountering is that when customers visit our site for the first time using Firefox for Android and Firefox for iOS, it correctly requests camera access, and everything works as expected. However, on subsequent visits (the second or third time), the component fails to load even though permissions are granted. Currently, the only workaround is to clear all site permissions and start fresh. |
@paternina the component throws an error if there are only non virtual cameras available, but it also checks for a few other constraints like frame rate and video width/height. Otherwise that's correct. Are you still able to reproduce this behavior if you remove the |
Hi @esauerbo Unfortunately I cannot share a public repository, it is a private work and company does not allow us to share it, but, the component is exactly like shared above, and I also shared the detectWebcam logic. I removed the detectWebcam logic and the issue persist, it request access to camera once, but subsequent visits do not request it. |
@paternina Can you share what you are using in the screenshot to debug? Are you using the camera anywhere else in your app which might be preventing the Liveness component from using it? In the screenshot I see the log message "Stopping active stream on Back Triple Camera". The Liveness component doesn't support using the back cameras, on the forward/user facing cameras. |
Hi @reesscot , yes we use a component to capture the user document (KYC flow) before the liveness process, it uses another package and a custom fallback option when customer device does not meet the minimum requirements for the first one. However, this step is completed successfully and then pass to LivenessDetector. |
@paternina That's good information, thanks for sharing. My suspicion is that your other component is not releasing the video stream, which is causing the Liveness component to be unable to access the camera. Can you try replacing the Liveness component with a getUserMedia call using the Liveness default constraints? |
Before creating a new issue, please confirm:
On which framework/platform are you having an issue?
React
Which UI component?
Liveness
How is your app built?
Vite
What browsers are you seeing the problem on?
Firefox
Which region are you seeing the problem in?
us-east-1
Please describe your bug.
Sometimes the package does not ask for camera permission on Firefox mobile, and keep on an infinite loop displaying the waitingCameraPermissionText.
Please note that it is intermittent, sometimes works, sometimes does not but it fails in most cases. It works fine on Firefox for desktop and other browsers, the issue is only on Firefox mobile.
What's the expected behaviour?
We should see a pop up requesting the camera access permission or display the component on the screen.
Help us reproduce the bug!
Code Snippet
Console log output
No console error, the request to create the session ID is OK.
Additional information and screenshots
The text was updated successfully, but these errors were encountered: