react-native-vision-camera
react-native-vision-camera copied to clipboard
🐛 takePhoto stuck on step 2/3
What's happening?
Sometimes the photo taking action gets stuck at step 2/3 and doesn't finish.
Reproduceable Code
const [cameraPosition, setCameraPosition] = useState<'front' | 'back'>('back')
const device = useCameraDevice(cameraPosition,{
physicalDevices: ['wide-angle-camera']
})
<Camera
ref={cameraRef}
device={device}
format={format}
hdr={enableHdr}
isActive={isActive}
onInitialized={onInitialized}
onError={onError}
enableZoomGesture={false}
orientation="portrait"
photo={true}
/>
Relevant log output
2024-01-10T16:12:45.808Z CameraView Updating CameraSession...
2024-01-10T16:12:45.809Z CameraSession configure { ... }: Waiting for lock...
2024-01-10T16:12:45.809Z CameraSession configure { ... }: Updating CameraSession Configuration... Difference(deviceChanged=true, outputsChanged=true, sidePropsChanged=true, isActiveChanged=true)
2024-01-10T16:12:45.809Z CameraSession isActive is false, skipping CameraDevice configuration.
2024-01-10T16:12:45.809Z CameraSession isActive is false, skipping CameraCaptureSession configuration.
2024-01-10T16:12:45.809Z CameraSession Successfully updated CameraSession Configuration! isActive: false
2024-01-10T16:12:45.865Z CameraView Updating CameraSession...
2024-01-10T16:12:45.866Z CameraSession configure { ... }: Waiting for lock...
2024-01-10T16:12:45.866Z CameraSession configure { ... }: Updating CameraSession Configuration... Difference(deviceChanged=true, outputsChanged=true, sidePropsChanged=true, isActiveChanged=true)
2024-01-10T16:12:45.866Z CameraSession Need to rebuild CameraDevice and CameraCaptureSession...
2024-01-10T16:12:45.866Z CameraSession Configuring Camera #0...
2024-01-10T16:12:45.870Z CameraView Updating CameraSession...
2024-01-10T16:12:45.872Z CameraDeviceClient CameraDeviceClient 0: Opened
2024-01-10T16:12:45.874Z CameraDevices Camera #0 is now unavailable.
2024-01-10T16:12:45.877Z CameraView Updating CameraSession...
2024-01-10T16:12:45.884Z CameraSession configure { ... }: Waiting for lock...
2024-01-10T16:12:45.889Z CameraSession Successfully configured Camera #0!
2024-01-10T16:12:45.890Z CameraSession Destroying previous outputs...
2024-01-10T16:12:45.891Z CameraSession Creating outputs for Camera #0...
2024-01-10T16:12:45.892Z CameraSession Adding 640x480 Photo Output in JPEG...
2024-01-10T16:12:45.895Z CameraDevice-JV-0 waitUntilIdle: E. id = 0
2024-01-10T16:12:45.895Z CameraSession PreviewView Surface created! Surface(name=null)/@0x88d76fc
2024-01-10T16:12:45.895Z CameraSession Setting Preview Output...
2024-01-10T16:12:45.896Z CameraSession PreviewView Surface updated! Surface(name=null)/@0x88d76fc 1298 x 2307
2024-01-10T16:12:45.896Z CameraDevice-JV-0 waitUntilIdle: X
2024-01-10T16:12:45.904Z CameraView Updating CameraSession...
2024-01-10T16:12:45.993Z CameraSession configure { ... }: Waiting for lock...
2024-01-10T16:12:45.993Z CameraSession Successfully configured Session with 1 outputs for Camera #0!
2024-01-10T16:12:45.994Z CameraSession CameraSession has no repeating outputs (Preview, Video, CodeScanner), skipping CaptureRequest...
2024-01-10T16:12:45.994Z CameraSession Successfully updated CameraSession Configuration! isActive: true
2024-01-10T16:12:45.994Z CameraView invokeOnInitialized()
2024-01-10T16:12:45.994Z CameraView A new configure { ... } call arrived, aborting this one...
2024-01-10T16:12:45.994Z CameraSession configure { ... }: Updating CameraSession Configuration... Difference(deviceChanged=false, outputsChanged=false, sidePropsChanged=false, isActiveChanged=false)
2024-01-10T16:12:45.994Z CameraSession Successfully updated CameraSession Configuration! isActive: true
2024-01-10T16:12:45.994Z CameraView A new configure { ... } call arrived, aborting this one...
2024-01-10T16:12:45.994Z CameraSession configure { ... }: Updating CameraSession Configuration... Difference(deviceChanged=false, outputsChanged=false, sidePropsChanged=false, isActiveChanged=false)
2024-01-10T16:12:45.994Z CameraSession Successfully updated CameraSession Configuration! isActive: true
2024-01-10T16:12:45.994Z CameraSession configure { ... }: Updating CameraSession Configuration... Difference(deviceChanged=false, outputsChanged=true, sidePropsChanged=true, isActiveChanged=false)
2024-01-10T16:12:45.994Z CameraSession Destroying previous outputs...
2024-01-10T16:12:45.998Z CameraSession Creating outputs for Camera #0...
2024-01-10T16:12:45.998Z CameraSession Adding 640x480 Photo Output in JPEG...
2024-01-10T16:12:45.999Z CameraSession Adding 1920x1080 Preview Output...
2024-01-10T16:12:46.001Z CameraDevice-JV-0 waitUntilIdle: E. id = 0
2024-01-10T16:12:46.001Z CameraDevice-JV-0 waitUntilIdle: X
2024-01-10T16:12:46.022Z CameraView Updating CameraSession...
2024-01-10T16:12:46.023Z CameraSession PreviewView Surface updated! Surface(name=null)/@0x88d76fc 1920 x 1080
2024-01-10T16:12:46.166Z CameraSession configure { ... }: Waiting for lock...
2024-01-10T16:12:46.166Z CameraSession Camera Session android.hardware.camera2.impl.CameraCaptureSessionImpl@cc8597e has been closed.
2024-01-10T16:12:46.166Z CameraSession Successfully configured Session with 2 outputs for Camera #0!
2024-01-10T16:12:46.169Z CameraView invokeOnStarted()
2024-01-10T16:12:46.169Z CameraSession Successfully updated CameraSession Configuration! isActive: true
2024-01-10T16:12:46.169Z CameraView A new configure { ... } call arrived, aborting this one...
2024-01-10T16:12:46.169Z CameraSession configure { ... }: Updating CameraSession Configuration... Difference(deviceChanged=false, outputsChanged=false, sidePropsChanged=false, isActiveChanged=false)
2024-01-10T16:12:46.169Z CameraSession Successfully updated CameraSession Configuration! isActive: true
2024-01-10T16:12:46.170Z CameraSession configure { ... }: Updating CameraSession Configuration... Difference(deviceChanged=false, outputsChanged=false, sidePropsChanged=false, isActiveChanged=false)
2024-01-10T16:12:46.170Z CameraSession Successfully updated CameraSession Configuration! isActive: true
2024-01-10T16:12:47.370Z CameraView Finding view 7629...
2024-01-10T16:12:47.370Z CameraView Found view 7629!
2024-01-10T16:12:47.370Z CameraView.takePhoto Taking photo... Options: {qualityPrioritization=speed, photoCodec=jpeg, enableShutterSound=false, flash=off, quality=40.0}
2024-01-10T16:12:47.370Z CameraSession Photo capture 0/3 - preparing capture request (640x480)...
2024-01-10T16:12:47.373Z CameraSession Photo capture 1/3 - starting capture...
2024-01-10T16:12:48.147Z CameraSession Photo Captured!
2024-01-10T16:12:48.147Z CameraSession Photo capture 2/3 complete - received metadata with timestamp 41170456771000
2024-01-10T16:12:48.147Z CameraSession Photo captured! 640 x 480
2024-01-10T16:15:00.245Z CameraView Updating CameraSession...
...
Camera Device
{
"sensorOrientation": "landscape-right",
"hardwareLevel": "full",
"maxZoom": 10,
"minZoom": 1,
"maxExposure": 24,
"supportsLowLightBoost": false,
"neutralZoom": 1,
"physicalDevices": [
"wide-angle-camera"
],
"supportsFocus": true,
"supportsRawCapture": true,
"isMultiCam": false,
"minExposure": -24,
"name": "BACK (0)",
"hasFlash": true,
"hasTorch": true,
"position": "back",
"id": "0"
}
Device
Pocophone M5s (Android 13), Samsung Galaxy A03 (Android 12), Galaxy S22 (Android 13)
VisionCamera Version
3.7.0
Can you reproduce this issue in the VisionCamera Example app?
Yes, I can reproduce the same issue in the Example app here
Additional information
- [X] I am using Expo
- [ ] I have enabled Frame Processors (react-native-worklets-core)
- [X] I have read the Troubleshooting Guide
- [X] I agree to follow this project's Code of Conduct
- [X] I searched for similar issues in this repository and found none.