Skip to content

[Liveness] Liveness SDK always opens with the front camera even when Camera.Back is passed in challengeOptions #257

@EmanoelLoreto

Description

@EmanoelLoreto

Before creating a new issue, please confirm:

Which UI component?

Liveness

Gradle script dependencies

    implementation 'com.amplifyframework.ui:liveness:1.6.0'
    implementation 'com.amplifyframework:aws-api:1.24.0'

Environment information

# Put output below this line
------------------------------------------------------------
Gradle 8.12
------------------------------------------------------------

Build time:    2024-12-20 15:46:53 UTC
Revision:      a3cacb207fec727859be9354c1937da2e59004c1

Kotlin:        2.0.21
Groovy:        3.0.22
Ant:           Apache Ant(TM) version 1.10.15 compiled on August 25 2024
Launcher JVM:  17.0.15 (Homebrew 17.0.15+0)
Daemon JVM:    /opt/homebrew/Cellar/openjdk@17/17.0.15/libexec/openjdk.jdk/Contents/Home (no JDK specified, using current Java home)
OS:            Mac OS X 15.3 aarch64

Please include any relevant guides or documentation you're referencing

No response

Describe the bug

When using the FaceLivenessDetector component, the camera always defaults to the front camera, regardless of the value provided in challengeOptions.

For example, even when explicitly setting the camera parameter to Camera.Back, the liveness session still opens with the front camera:

FaceLivenessDetector(
    sessionId = sessionId,
    region = region,
    credentialsProvider = credentialsProvider,
    disableStartView = false,
    onComplete = onComplete,
    onError = onError,
    challengeOptions = ChallengeOptions(
        faceMovementAndLight = LivenessChallenge.FaceMovementAndLight,
        faceMovement = LivenessChallenge.FaceMovement(camera = Camera.Back)
    )
)

Reproduction steps (if applicable)

No response

Code Snippet

// Put your code below this line.
setContent {
            MaterialTheme(
                colorScheme = LivenessColorScheme.default()
            ) {
                FaceLivenessDetector(
                    sessionId = sessionId,
                    region = region,
                    credentialsProvider = credentialsProvider,
                    disableStartView = false,
                    onComplete = {
                        finishWithSuccess("Face Liveness completed successfully")
                    },
                    onError = { error ->
                        finishWithError("Face Liveness error: ${error.message}")
                    },
                    challengeOptions = ChallengeOptions(
                        faceMovementAndLight = LivenessChallenge.FaceMovementAndLight,
                        faceMovement = LivenessChallenge.FaceMovement(camera = Camera.Back)
                    )
                )
            }
        }

Log output

// Put your logs below this line


Configuration File

No response

Additional information and screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    livenessThis issue relates to the Liveness componentquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions