Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/472.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript React本地世博相机景观视频_Javascript_Typescript_React Native_Expo_Expo Camera - Fatal编程技术网

Javascript React本地世博相机景观视频

Javascript React本地世博相机景观视频,javascript,typescript,react-native,expo,expo-camera,Javascript,Typescript,React Native,Expo,Expo Camera,我正在录制一些不同方向(横向和纵向)的视频,但我的应用程序被配置强制处于纵向模式。问题是每条记录的结果都以纵向方式保存 有没有办法在不更改配置的情况下确定结果方向 这是我的相机组件: import { Camera } from 'expo-camera' ... private onStartRecording = () => { if (this.ref.current && this.state.isCameraReady && this.

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

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

这是我的相机组件:

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}
  />)
从“expo Camera”导入{Camera}
...
私有onStartRecording=()=>{
if(this.ref.current&&this.state.isCameraReady&&this.isRightOrientation()){
this.setState({fileUrl:'',isRecording:true})
this.ref.current.recordAsync({quality:'720p'})
。然后((文件)=>{
if(this.props.format=='horizontal'&&!this.props.isVideo)
ImageManipulator.manipulaEasync(
file.uri,
[{rotate:this.state.orientation},{flip:ImageManipulator.FlipType.Horizontal}],
)。然后(文件=>{
this.setState({fileUrl:file.uri})
}).then(error=>console.log(“error”,error))
否则{
this.setState({fileUrl:file.uri})
}
}).catch(error=>console.log(“error”,error));
}
}
...
返回(
this.setState({isCameraReady:true})
类型={this.state.type}
/>)