Skip to content

Allow switching between back and front camera #4

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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