Comments (7)
I am also facing this issue with iPad Pro 10.5 inch(17.4.1) in front camera, for back camera it is working fine and i also tested with android 12 (vivo s1 pro) it is working good.
const device = useCameraDevice(state.position);
const format = useCameraFormat(device, [
{photoAspectRatio: 4 / 3},
{videoAspectRatio: 4 / 3},
{
photoResolution: {
height: 520,
width: 390,
},
},
{
videoResolution: {
height: 520,
width: 390,
},
},
]);
const CaptureImage = async () => {
const photo = await cameraRef.current?.takePhoto();
console.log(photo);
setState(prev => ({
...prev,
url: photo?.path,
}));
};
return (
<View style={{flex: 1, backgroundColor: '#fff'}}>
<View style={{flex: 1}}>
<Camera
ref={cameraRef}
photo
isActive
format={format}
device={device}
style={{
// height: 520,
// width: 390,
aspectRatio: 3 / 4,
}}
/>
</View>
<View
style={{
flexDirection: 'row',
justifyContent: 'space-evenly',
}}>
<Button title="Capture" color={'green'} onPress={CaptureImage} />
<Button
title="Switch"
color={'red'}
onPress={() => {
setState(prev => ({
...prev,
position: prev.position == 'front' ? 'back' : 'front',
}));
}}
/>
</View>
</View>
);
}
from react-native-vision-camera.
Hey!
Preview is a video-stream, so it uses the aspect ratio from videoResolution
/videoAspectRatio
in the Format.
You could prioritize video aspect ratio by moving it up, but then the photo still looks different.
I guess some photos just have a different aspect ratio for the photos stream or the video stream.
Does it look proper when you set both photoAspectRatio
and videoAspectRatio
to 4 / 3
? Remove the fps
from the filter as well, that may exclude some filters as it is spot 1 (highest priority)
from react-native-vision-camera.
I removed all filters, only put in a videoAspectRatio
and nothing changes, also tried combinations of just photoAspectRatio
and flipping their order.
It just feels like resizeMode='contain'
is hard coded (somewhere) to 4/3 ish.
I think after all this testing, im just going to use resizeMode='cover'
(or really just remove the prop as its the default), as that seems like what all example apps use and its fairly close.
TL;DR
After lots of testing i think best practices with v4 is use no resizeMode
(aka 'cover'), and ensure that the Preview's <View>
's aspect ratio is the same as your photo format.
And maybe recommend to delete this prop since it doesn't seem to do much with v4 just causes confusion? Or I'm still doing something wrong.
from react-native-vision-camera.
And maybe recommend to delete this prop since it doesn't seem to do much with v4 just causes confusion?
Not true. On iOS it works fine. Also it does change behaviour on Android. Why would I delete that prop?
from react-native-vision-camera.
Seems related to this issue: #2845
from react-native-vision-camera.
same issue, in cover mode, the preview size is slightly larger than the actual photo size. How to solve this problem?
from react-native-vision-camera.
from react-native-vision-camera.
Related Issues (20)
- ๐ Frame Processor Plugin Build Failed: 'FrameHostObject.h' file not found HOT 1
- ๐ง iOS Obj-C++ Frame Processor Plugin Build Failed: 'FrameHostObject.h' not found HOT 9
- ๐ videoBitRate parameter has no effect on Samsung Galaxy S24 HOT 2
- ๐ onCodeScanned callback executes multiple times HOT 6
- ๐ง Using plugins with expo 51 android HOT 2
- ๐ญ How to take a photo in portrait preview with portrait orientation output? HOT 3
- ๐ Crash on device without any cameras HOT 1
- ๐ Crash on device without any cameras HOT 19
- ๐ intermittent Crash Due to Permission HOT 8
- ๐ Camera access prompt appears prematurely HOT 5
- ๐ `frame.isMirrored` is `false` with selfie camera on iOS HOT 2
- ๐ application crushes during resize attemp HOT 8
- ๐ญ How to get a 9/16 aspect ratio for photos and videos? HOT 9
- ๐ง Android Build Error Imported target "react-native-worklets-core::rnworklets" includes non-existent path HOT 4
- ๐ Android Crash on video recording without using frame processor/react-native-worklets-core HOT 7
- ๐ญ Async Frame Processors with Event Emitters HOT 5
- ๐ญ App upadates Rejecting| External Storage Permission restricated due to latest policy. HOT 4
- ๐ [IOS] On iPhone 8 the camera screen is displayed horizontally on release mode but work perfectly on debug mode HOT 1
- ๐ [IOS] On iPhone 8 the camera screen is displayed horizontally on release mode but work perfectly on debug mode HOT 2
- ๐ญ Is there a way to get the focal length of the camera? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-vision-camera.