Skip to content

Conversation

fmardini
Copy link

@fmardini fmardini commented Apr 4, 2022

Allow changing camera between back and front

Tested completely on Android, but iOS simulator doesn't support cameras.

Thanks.

"switchCamera" -> {
val isFront = call.argument("lensFacing") as String?
lensFacing =
if (isFront?.equals("FRONT") == true) CameraSelector.LENS_FACING_BACK else CameraSelector.LENS_FACING_BACK

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For if, there should be CameraSelector.LENS_FACING_FRONT. Since both condition have same statement you cannot toggle back to front camera after switching it to the back camera for the first time. Please update this in your commit. I found your commit very helpful for my project. This was the only issue I found. ThankYou:) Happy Coding

@@ -30,6 +30,7 @@ class _MyAppState extends State<MyApp> {

bool _isDetectingPose = false;
bool _isDetectingBodyMask = false;
LensFacing _lens = LensFacing.back;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LensFacing _lens = LensFacing.front;
Updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants