Skip to content

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

Open
@ssukru

Description

@ssukru

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    LivenessbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions