延迟图像捕获-React Native Camera/Expo Camera [英] Delay on the capture of an image - React Native Camera / Expo Camera

查看:103
本文介绍了延迟图像捕获-React Native Camera/Expo Camera的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实现与Facebook或Instagram相同的功能:
立即预览相机拍摄的图像

I am trying to realize the same functionnality as in Facebook or Instagram:
Preview the image taken by the camera instantly

在这一点上,当我调用此函数时,我采取的是正确的:

At this point, my taken is correctly taken when this function is called :

takePicture = async function() {
   if (this.camera && this.state.isConnected === true) {
      const options = { quality: 0, base64: false };
      const data = await this.camera.takePictureAsync(options);
      this.toLoading(data.uri);
   }
};

如此处所示,相机质量选项设置为0,以确保问题不是由图像处理引起的.

As displayed here, camera quality option is set to 0 to assure that the issue isn't caused by image processing.

我也将RNCamera道具降低了:

I also have set my RNCamera props to lower as so :

      autoFocus={"off"}
      skipProcessing={true}
      type={"back"}
      flashMode={"off"}
      zoom={0}
      whiteBalance={"auto"}
      ratio={"16:9"}

我在android和ios上都对此进行了测试,即使ios似乎可以更快地执行此操作,它仍然不能立即执行.
有没有人能够使用react native来复制facebook/instagram相机预览?我一直在寻找github仓库,在我的情况下似乎有很多人,但仍然没有解决方案.我还注意到,人们已经尝试退出expo项目以执行本机代码,但是延迟仍然存在.

I tested this on both android and ios and even if ios seems to execute this a little bit faster, it still doesn't do it instantly.
Has anyone been able to reproduce the facebook/instagram camera preview with react native? I have been looking on the github repo and there seem to be a lot of people in my situation but still no resolution. I have also noted that people have tried to eject expo projects to go on native code but the latency is still present.

推荐答案

现在有一个skipProcessing标志,旨在帮助更快地显示图像

There is now a skipProcessing flag which is meant to help the image display faster

this.camera.takePictureAsync({skipProcessing: true})

SDK 30的文档说,这可能会导致图像旋转不正确.

The documentation for SDK 30 says this may cause the image to be rotated incorrectly.

https://docs.expo.io/versions/latest/sdk/camera

这篇关于延迟图像捕获-React Native Camera/Expo Camera的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆