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

When using Liveness with PlatformViewLink in Flutter, the camera freezes intermittently on Android10 devices. #202

Open
2 tasks done
zhonadan opened this issue Nov 8, 2024 · 1 comment
Labels
closing soon This issue will be closed in 7 days unless further comments are made. pending-communitiy-response Issue is pending response from the issue requestor question Further information is requested

Comments

@zhonadan
Copy link

zhonadan commented Nov 8, 2024

Before creating a new issue, please confirm:

Which UI component?

Liveness

Gradle script dependencies

implementation 'com.amplifyframework.ui:liveness:1.2.6'
implementation 'com.amplifyframework:aws-auth-cognito:2.16.1'

Environment information

Welcome to Gradle 7.6.1!

Here are the highlights of this release:
 - Added support for Java 19.
 - Introduced `--rerun` flag for individual task rerun.
 - Improved dependency block for test suites to be strongly typed.
 - Added a pluggable system for Java toolchains provisioning.

For more details see https://docs.gradle.org/7.6.1/release-notes.html


------------------------------------------------------------
Gradle 7.6.1
------------------------------------------------------------

Build time:   2023-02-24 13:54:42 UTC
Revision:     3905fe8ac072bbd925c70ddbddddf4463341f4b4

Kotlin:       1.7.10
Groovy:       3.0.13
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          17.0.10 (JetBrains s.r.o. 17.0.10+0-17.0.10b1087.21-11572160)
OS:           Mac OS X 14.4 aarch64

Please include any relevant guides or documentation you're referencing

No response

Describe the bug

We are using PlatformViewLink to integrate Liveness features in Flutter.

The camera screen freezes intermittently on Android10 devices.
I haven't found the issue on other OS versions.

Reproduction steps (if applicable)

Add the Liveness Android View to the Flutter screen using PlatformViewLink,
After closing and reopening the screen a few times, the camera preview screen freezes.

Code Snippet

composeView.setContent {
    MaterialTheme(
            colorScheme = LivenessColorScheme.default()
    ) {
        sessionId?.let {
            FaceLivenessDetector(
                    sessionId = it,
                    region = "***",
                    onComplete = {
                        sendMessageToFlutter("complete", it, null)
                    },
            )
        }
    }
}
PlatformViewLink(
  key: ValueKey(androidRebuildSignal.current),
  viewType: _viewType,
  surfaceFactory: (context, controller) {
    return AndroidViewSurface(
      controller: controller as AndroidViewController,
      gestureRecognizers: const <Factory<OneSequenceGestureRecognizer>>{},
      hitTestBehavior: PlatformViewHitTestBehavior.opaque,
    );
  },
  onCreatePlatformView: (params) {
    return PlatformViewsService.initSurfaceAndroidView(
      id: params.id,
      viewType: _viewType,
      layoutDirection: TextDirection.ltr,
      creationParams: creationParams,
      creationParamsCodec: const StandardMessageCodec(),
      onFocus: () {
        params.onFocusChanged(true);
      },
    )
      ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated)
      ..create();
  },
)

Log output

No response

amplifyconfiguration.json

{
"auth": {
"plugins": {
"awsCognitoAuthPlugin": {
"CredentialsProvider": {
"CognitoIdentity": {
"Default": {
"PoolId": "",
"Region": "
"
}
}
}
}
}
}
}

Additional information and screenshots

No response

@github-actions github-actions bot added pending-triage Issue is pending triage pending-maintainer-response Issue is pending response from an Amplify team member labels Nov 8, 2024
@tylerjroach
Copy link
Member

Hi @zhonadan, I'm glad to see you have gotten Liveness running on Flutter. Unfortunately, we do not have a native Flutter Liveness component and we do not test support for flutter with the Android FaceLivenessDetector.

It sounds like you may be running into a Flutter specific bug that does not directly involve the Android liveness component. I understand the desire code fully within Flutter, but if you continue to run into issues, I would recommend writing FaceLivenessDetector within its own native Android Activity. You can launch the activity from within Flutter and then return back into Flutter once the FaceLivenessDetector has completed.

@tylerjroach tylerjroach added the question Further information is requested label Nov 8, 2024
@github-actions github-actions bot removed pending-maintainer-response Issue is pending response from an Amplify team member pending-triage Issue is pending triage labels Nov 8, 2024
@vincetran vincetran added closing soon This issue will be closed in 7 days unless further comments are made. pending-communitiy-response Issue is pending response from the issue requestor labels Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closing soon This issue will be closed in 7 days unless further comments are made. pending-communitiy-response Issue is pending response from the issue requestor question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants