我正在通过Expo构建相机应用(Android目标)。我的问题是在录制视频时。暂停后我期待着继续播放视频,应该继续录制,但是保存录制的视频后冻结了。
这是我的代码:
if (!this.state.isStartRecordVideo) {
this.props.pauseRecordVideo();
}
else {
this.props.resumeRecordVideo();
}
startRecordVideo
方法开始录制视频:
async startRecordVideo() {
let video = await this.camera.recordAsync({ quality: '1080' });
await CameraRoll.saveToCameraRoll(video.uri, 'video');
}
[stopRecordVideo
方法来停止并保存录制视频(在startRecordVideo
方法中返回承诺)]
async stopRecordVideo() {
await this.camera.stopRecording();
}
[FooterCamera
是包含pausePreview
和resumePreview
]的组件>
<FooterCamera ref={(footer) => this.footer_camera = footer} imageUri={this.state.imageUri} takePicture={(timer, quality) => this.takePicture(timer, quality)} startRecordVideo={() => this.startRecordVideo()} stopRecordVideo={() => this.stopRecordVideo()} pauseRecordVideo={() => this.camera.pausePreview()} resumeRecordVideo={() => this.camera.resumePreview()} stopCountDownAnimate={() => this.stopCountDownAnimate()} />
- 博览会版本:2.1.3
我正在通过Expo构建相机应用(Android目标)。我的问题是在录制视频时。暂停后我期待着继续播放视频,应该继续录制,但是保存后就冻结了...
pausePreview
功能是否可以暂停录音?我不这么认为...只是暂停“预览”,而不是录制。请仔细检查参考中的pausePreview()
和resumePreview()
功能。