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

Record video in Landscape Mode not working in IOS🐛 #1725

Closed
3 of 4 tasks
HemangiVekaria opened this issue Aug 28, 2023 · 8 comments
Closed
3 of 4 tasks

Record video in Landscape Mode not working in IOS🐛 #1725

HemangiVekaria opened this issue Aug 28, 2023 · 8 comments
Labels
🐛 bug Something isn't working

Comments

@HemangiVekaria
Copy link

What were you trying to do?

I am using react-native-vision-camera for recording video in Portrait and landscape.
By using react-native-orientation-locker i am locking preview to Landscape or portrait. When click on Landscape button from app camera is opening at that time i lock orientation to landscape so my screen UI rendered in Landscape but preview of camera is showing portrait.

Can anyone please help to record video in landscape. i tried orientations "landscapeLeft",etc but nothing works.

Reproduceable Code

<Camera
                                style={StyleSheet.absoluteFill}
                                ref={cameraRef}
                                device={deviceAndroid}
                                isActive={true}
                                video={true}
                                videoStabilizationMode="standard"
                                enableZoomGesture={true}
                                format={{
                                    videoWidth: getPictureSize().width,
                                    videoHeight: getPictureSize().height,
                                    photoWidth: getPictureSize().width,
                                    photoHeight: getPictureSize().height,
                                    frameRateRanges: [
                                        {
                                            minFrameRate: 24,
                                            maxFrameRate: 30,
                                        },
                                    ],
                                }}
                                audio={true}></Camera>

What happened instead?

app is showing preview in portrait.! IMG_A4CF2BCA3492-1

Relevant log output

No response

Device

iPhone X (IOS 16.6)

VisionCamera Version

2.15.6

Additional information

@HemangiVekaria HemangiVekaria added the 🐛 bug Something isn't working label Aug 28, 2023
@fedpre
Copy link

fedpre commented Sep 5, 2023

Hi @HemangiVekaria , I was able to change the native code to have a "working" version of the orientation change in iOS for the new 3.0 version.

Basically, I added a listener to the orientation change and it changes whenever the device changes orientation. It's probably not perfect nor ideal, but it works!

I can share the code with you (the patch) if you that helps!

@HemangiVekaria
Copy link
Author

Hi @HemangiVekaria , I was able to change the native code to have a "working" version of the orientation change in iOS for the new 3.0 version.

Basically, I added a listener to the orientation change and it changes whenever the device changes orientation. It's probably not perfect nor ideal, but it works!

I can share the code with you (the patch) if you that helps!

Hi @fedpre Thanks, Please share patch that will be very helpful for me.

@fedpre
Copy link

fedpre commented Sep 5, 2023

Hi @fedpre Thanks, Please share patch that will be very helpful for me.

Not sure if this is the best way, but attached is the patch. Let me know if it works!
react-native-vision-camera+3.0.0.patch

@PrgrmmrOleg
Copy link

Hi @fedpre Thanks, Please share patch that will be very helpful for me.

Not sure if this is the best way, but attached is the patch. Let me know if it works! react-native-vision-camera+3.0.0.patch

Works fine for me. Thank you. You saved my deadline

@fedpre
Copy link

fedpre commented Sep 13, 2023

Hi @fedpre Thanks, Please share patch that will be very helpful for me.

Not sure if this is the best way, but attached is the patch. Let me know if it works! react-native-vision-camera+3.0.0.patch

Works fine for me. Thank you. You saved my deadline

Glad that it worked and helped you!

@HemangiVekaria
Copy link
Author

Hi @fedpre Thanks, Please share patch that will be very helpful for me.

Not sure if this is the best way, but attached is the patch. Let me know if it works! react-native-vision-camera+3.0.0.patch

After adding this patch in andorid camera is not showing. it shows black screen. <Camera style={StyleSheet.absoluteFill} ref={cameraRef} device={deviceAndroid} isActive={true} video={true} enableZoomGesture={true} format={{ videoWidth: getPictureSize().width, videoHeight: getPictureSize().height, photoWidth: getPictureSize().width, photoHeight: getPictureSize().height, frameRateRanges: [ { minFrameRate: 24, maxFrameRate: 30, }, ], }} audio={true}></Camera>

@mrousavy
Copy link
Owner

Closing as this is a stale issue - this might have been fixed with the full rewrite in VisionCamera V3 (🥳) - if not, please create a new issue.

If your issue has been fixed, consider sponsoring me on GitHub to say thanks 💖

JFYI; Orientation is a bit more tricky - if I get enough sponsors I can work on this. Camera sensors are always 90deg

@mrousavy
Copy link
Owner

Hey - I'm tracking Orientation in this feature request/issue now: #1891

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants