[英]expo-camera takePictureAsync() not working on Android
I recently updated several lines of code in a managed expo project, unrelated to the camera functionality.我最近更新了托管博览会项目中的几行代码,与相机功能无关。 It still works fine on iOS, only Android does not work.
它在 iOS 上仍然可以正常工作,只有 Android 无法正常工作。 I had released a previous version one month ago that worked well.
一个月前我发布了一个运行良好的先前版本。 When I revert back to the old commit from then, though, it also does not work on Android (iOS fine).
但是,当我从那时起恢复到旧的提交时,它在 Android 上也不起作用(iOS 很好)。
There is no issue launching the camera, etc. Rather, the issue occurs at takePictureAsync, which hangs and then does not return anything.启动相机等没有问题。相反,问题发生在 takePictureAsync,它挂起然后不返回任何内容。
const snapPic = async () => {
const { status } = await Camera.getCameraPermissionsAsync();
if (status != 'granted') {
alert('Please grant access to camera and retry.');
await Camera.requestCameraPermissionsAsync();
return;
}
const options = { quality: 0.1 };
const photo = await this.camera.takePictureAsync(options);
this.camera.pausePreview();
this.setState({imageSource: photo.uri});
};
<Camera style={styles.cameraBox} ref={ref => {this.camera = ref}} />
Please let me know what other information I can provide, if necessary.如有必要,请告诉我我可以提供哪些其他信息。 Thanks in advance!
提前致谢!
Instead of pause preview method.而不是暂停预览方法。 Try it with skipProcessing to false inside option object
尝试在选项对象内使用 skipProcessing 为 false
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.