Skip to content

Ability to toggle camera and set a defaultOrientation#23

Open
sunragav wants to merge 2 commits intokalinjul:mainfrom
sunragav:toggle-camera-and-default-camera-orientation
Open

Ability to toggle camera and set a defaultOrientation#23
sunragav wants to merge 2 commits intokalinjul:mainfrom
sunragav:toggle-camera-and-default-camera-orientation

Conversation

@sunragav
Copy link

Features Added: 1. Ability to toggle the camera front and back 2. Setting a default orientation so that the orientation looks correct when a capture session is started in iPad (which should be landscape, which becomes portrait sometimes). Updated the sample project accordingly.

Problem:
In iPad, when the app is in landscape mode, the orientation starts in portrait instead of landscape.

2025-05-25.04-35-53.mp4

…ting a default orientation so that the orientation looks correct when a capture session is started in iPad (which should be landscape, which becomes portrait sometimes). Updated the sample project accordingly.
@sunragav
Copy link
Author

@kalinjul @DevinDuricka Please review.

Adding   defaultOrientation parameter in the Scanner.jvm
@DevinDuricka
Copy link
Contributor

Hey @sunragav thanks for your contribution! I'm not actually the owner of the project, so I will defer to @kalinjul for final approval. From what I can tell though, the code looks good. Unfortunately I don't have an iOS device or Mac to build/test.

I might consider altering the class definition to instantiate the defaultOrientation as null. That way when people pull the updated library, they don't have to update their camera objects (unless they want to set a default orientation).
defaultOrientation: CameraOrientation? to defaultOrientation: CameraOrientation? = null

Another item to consider - and I haven't researched this at all, so I'll be interested to hear what you think - is there a KMP way to capture the devices orientation?

@kalinjul
Copy link
Owner

Thanks for your contribution!
I didn't yet have the time to try this, but if you could split the two features into separate PRs, maybe starting with the possibility to switch between front/back camera after initialization, it would be much easier to test and review!

Also about orientation - right now it should use the device's orientation at initalization time, right? So i guess it shouldn't be necessary at all to pick orientation, but instead use the current device's orientation and update accordingly. I will also look into this when i find the time.

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.

3 participants