暂停和继续录制视频无法继续

时间:2018-11-26 11:36:07

标签: android react-native camera record expo

我正在用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是包含pausePreviewresumePreview

的组件
<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()}
/>
  1. 博览会版本:2.1.3
  2. 设备:android

1 个答案:

答案 0 :(得分:0)

pausePreview功能可以暂停录制吗?我不这么认为...只是暂停“预览”,而不是录制。请仔细检查有关参考中的pausePreview()resumePreview()函数。

相关问题