Expo SDK28 Camera takePictureAsync delay on Android

#1

I already checked: https://github.com/expo/expo/issues/706 and it says there to set a pictureSize. I have the following code, but it also takes a while to show preview of the camera 3-5 seconds delay.

collectPictureSizes = async () => {
    if (this.camera) {
      await this.camera.getAvailablePictureSizesAsync('4:3')
        .then(pictureSizes => {
          let pictureSizeId = 0;
          pictureSizeId = pictureSizes.length - 1;
          this.setState({ pictureSize: pictureSizes[pictureSizeId] }, () => {
            console.log('Picture Size Set');
          });
        });
    }
};

<Expo.Camera
   ref={this.handleCameraRef}
   style={cameraStyle}
   type={this.state.type}
   flashMode={this.state.flash}
   autoFocus={this.state.autoFocus}
   pictureSize={this.state.pictureSize}
   onCameraReady={this.collectPictureSizes.bind(this)}
/>

PictureSize is getting set properly with the console.log triggering, but it still take a long while to show preview of the photo. Thanks.

1 Like
closed #2

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.