Mijick / CameraView

Camera made simple (SwiftUI)
MIT License
192 stars 20 forks source link

Block Screen Rotation for MCameraController locks all view orientations #9

Open jamesbradleym opened 3 months ago

jamesbradleym commented 3 months ago

Per the read.me: https://github.com/Mijick/CameraView?tab=readme-ov-file#4-optional-block-screen-rotation-for-mcameracontroller

It sounds as though only the camera controller will be locked but actually setting .lockOrientation(AppDelegate.self) locks every other view as well if it is visible. This seems to be a particularly difficult issue to solve, locking a single view's orientation while allowing other views to freely rotate based on orientation of the device..

FulcrumOne commented 3 months ago

Hey @jamesbradleym,

Thanks for this comment. Unfortunately I hadn't thought of that case where other views not related to the camera view are also visible. Implementing it the way you described will be quite difficult, but could you show me the screen view you're trying to implement, then maybe I can come up with something 'creative'. Thanks again for discovering this problem and have a good day, T.K.

jamesbradleym commented 3 months ago

It certainly seems to be, I haven't yet found a single solution which is why originally I made my own camera view before seeing your project which looks great.

The use case is allowing users to, for example, use a top drawer that you can pull down (similar gesture as pulling down settings from the upper right of an iOS device) which contains additional settings (or in my case a music player controller which also includes a search feature for spotify, so it activates the keyboard which if the orientation is locked to portrait would mean the keyboard pops out from the side 😅).

Or something like the video recording timer going from top of portrait to top of landscape rather than staying top of portrait when the user changes orientation.

Thanks for taking the time, really looking forward to using CameraView!

FulcrumOne commented 3 months ago

Ohh, I see. I'll try to fix it in this iteration if I still have time (it must be finished by 17 June, as our other libraries are also waiting to be updated 😅).

Thanks again for this finding and I hope you'll find the library useful!