Camera Video Ratio

Hi, i’ve want 1:1 result of my video but is not working. I use props ‘1:1’ and style the camera with and same length, but still the result of the video would be 3:4. This is my code

<View style={{ flex: 1 }}>
<Camera
ratio={ ‘1:1’ }
autoFocus={Camera.Constants.AutoFocus.on}
style={{ flex: 1 }}
type={ this.state.cameraType }
ref={ref => { this.camera = ref; }}>

<View style={ styles.camera__actions }>
<Touchable style={ styles.camera__actions__item } onPress={ this.flipCamera } disabled={ this.state.recording }>
<Text style={{ color: this.state.recording ? ‘grey’ : ‘black’ }}>Flip Camera

<Touchable style={ styles.camera__actions__item } onPress={ this.recordingVideo }>
{ this.state.recording ? ‘Stop’ : ‘Record’ }

<Touchable style={ styles.camera__actions__item }>
<Text style={{ color: this.state.recording ? ‘black’ : ‘grey’ }}>Durasi: { this.state.timeInterval } detik


Hi @kevinhimawanhie

You can use ImagePicker.launchCameraAsync from expo,
you don’t need to create your own design for the camera.

launchCamera = async () => {
const {
status: cameraPerm
} = await Permissions.askAsync(Permissions.CAMERA);
const {
status: cameraRollPerm
} = await Permissions.askAsync(Permissions.CAMERA_ROLL);
if (cameraRollPerm === ‘granted’) {
let result = await ImagePicker.launchCameraAsync({
allowsEditing: true,
aspect: [1, 1],
});
}
};

Thanks

1 Like