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