Skip to content
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

Infrared Camera Incorrectly Selected for Liveness Detection on Pixel 4 #6199

Open
4 tasks done
ssukru opened this issue Nov 22, 2024 · 3 comments
Open
4 tasks done

Infrared Camera Incorrectly Selected for Liveness Detection on Pixel 4 #6199

ssukru opened this issue Nov 22, 2024 · 3 comments
Labels
bug Something isn't working Liveness

Comments

@ssukru
Copy link

ssukru commented Nov 22, 2024

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?

Create React App

What browsers are you seeing the problem on?

Android (React Native)

Which region are you seeing the problem in?

No response

Please describe your bug.

The FaceLivenessDetector component incorrectly selects the infrared camera (used for face unlock) instead of the regular selfie camera when performing liveness validation on Pixel 4 devices. This causes the liveness detection to fail as it attempts to use the infrared camera feed instead of the normal camera feed.

Environment:

  • Device: Pixel 4
  • Packages:
    @aws-amplify/ui-react: 6.1.10
    @aws-amplify/ui-react-liveness: 3.0.23

What's the expected behaviour?

The regular front-facing (selfie) camera should be activated for liveness detection.

Help us reproduce the bug!

Steps to Reproduce

  • Initialize FaceLivenessDetector component
  • Attempt to perform liveness validation
  • Observe that the infrared camera is activated instead of the normal selfie camera

Code Snippet

return (
    <ThemeProvider>
      <div className="App">
        {!sessionId ? (
          <Loader />
        ) : (
          <FaceLivenessDetector
            sessionId={sessionId}
            region="eu-west-1"
            disableStartScreen={true}
            onAnalysisComplete={handleAnalysisComplete}
            onError={(error) => {
              console.error(error);
            }}
            displayText={displayText}
            onUserCancel={() => sendMessageToNative({ status: "CLOSED" })}
          />
        )}
      </div>
    </ThemeProvider>
  );

Console log output

No response

Additional information and screenshots

The infrared camera (used for face unlock) is being detected as the first available camera on getUserMedia call, causing the liveness detection to fail.

The issue occurs in:
packages/react-liveness/src/components/FaceLivenessDetector/service/machine/machine.ts
in the checkVirtualCameraAndGetStream function.

Here is my suggestion:
Filter out infrared cameras from the device selection process by:

  1. Adding infrared camera detection
  2. Filtering out infrared cameras from real video devices
  3. Validating existing devices against infrared camera check

Here are some references that made me think this can be solved like above:

Here is a screenshot
Ekran Resmi 2024-11-22 21 23 27

@github-actions github-actions bot added pending-triage Issue is pending triage pending-maintainer-response Issue is pending response from an Amplify UI maintainer labels Nov 22, 2024
@ssukru
Copy link
Author

ssukru commented Nov 22, 2024

and also if possible, i'd like to propose a PR if the issue accepted and the way i'll use accepted

@dindjarinjs
Copy link
Contributor

@ssukru Thanks for reporting this issue. If you have a working solution, please feel free to open a PR!

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify UI maintainer label Nov 22, 2024
@dindjarinjs dindjarinjs added bug Something isn't working Liveness and removed pending-triage Issue is pending triage labels Nov 22, 2024
@ssukru
Copy link
Author

ssukru commented Nov 22, 2024

@dindjarinjs thanks for quick response. i'll prepare a PR soon, hopefully this weekend!

@github-actions github-actions bot added the pending-maintainer-response Issue is pending response from an Amplify UI maintainer label Nov 22, 2024
@cwomack cwomack removed the pending-maintainer-response Issue is pending response from an Amplify UI maintainer label Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Liveness
Projects
None yet
Development

No branches or pull requests

3 participants