4

我正在以不同的方向(横向和纵向)录制一些视频,但我的应用程序被迫通过配置处于纵向模式。问题是每条记录的结果都是纵向保存的。

有没有办法在不更改配置的情况下决定结果方向?

这是我的相机组件:

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}
  />)
4

0 回答 0