Delay on the capture of an image - React Native Camera / Expo Camera

只谈情不闲聊 提交于 2020-08-27 02:31:13

问题


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

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

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"}

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.


回答1:


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

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

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

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



来源:https://stackoverflow.com/questions/50405983/delay-on-the-capture-of-an-image-react-native-camera-expo-camera

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!