React Native expo-camera landscape video

815 views Asked by At

I'm recording some videos in different orientation (landscape and portrait) but my app is forced to be in portrait mode by config. The problem is that the result of every record is saved in portrait.

Is there any way to decide the result orientation without changing config?

This is my camera component:

import { Camera } from 'expo-camera'

...

private onStartRecording = () => {
    if (this.ref.current && this.state.isCameraReady && this.isRightOrientation()) {
      this.setState({ fileUrl: '', isRecording: true })
      this.ref.current.recordAsync({ quality: '720p' })
        .then((file) => {
          if (this.props.format === 'horizontal' && !this.props.isVideo)
            ImageManipulator.manipulateAsync(
              file.uri,
              [{ rotate: this.state.orientation }, { flip: ImageManipulator.FlipType.Horizontal }],
            ).then(file => {
              this.setState({ fileUrl: file.uri })
            }).then(error => console.log("Error", error))
          else {
            this.setState({ fileUrl: file.uri })
          }
        }).catch(error => console.log("Error", error));
    }
  }

...

return (
  <Camera
    style={styles.camera}
    ref={this.ref}
    ratio='16:9'
    onCameraReady={() => this.setState({ isCameraReady: true })}
    type={this.state.type}
  />)
0

There are 0 answers