react-native-vision-camera icon indicating copy to clipboard operation
react-native-vision-camera copied to clipboard

🐛 Black screen on Pixel 8 Pro

Open felipejh opened this issue 1 year ago • 5 comments

What's happening?

I have the issue reported here https://github.com/mrousavy/react-native-vision-camera/issues/2862 and solved here https://github.com/mrousavy/react-native-vision-camera/pull/2897.

My device is a Pixel 8 Pro. I have tried both qualityPrioritization="speed" and qualityPrioritization="quality".

  • react-native-vision-camera: 4.5.2
  • react-native": 0.74.5

Reproduceable Code

const devices = useCameraDevices();

<Camera
   ref={cameraRef}
   style={StyleSheet.absoluteFill}
   device={device as CameraDevice}
   isActive={isActive}
   photo={true}
   video={false}
   onInitialized={onInitialized}
   onError={onError}
   photoQualityBalance="speed"
   lowLightBoost={device?.supportsLowLightBoost}
   enableZoomGesture={false}
   animatedProps={cameraAnimatedProps}
/>

Relevant log output

Camera error: [session/invalid-output-configuration]: Failed to configure the Camera Session because the output/stream configurations are invalid! (caused by {"stacktrace":"java.lang.IllegalArgumentException: Surface was abandoned\n\tat android.hardware.camera2.utils.SurfaceUtils.getSurfaceSize(SurfaceUtils.java:135)\n\tat android.hardware.camera2.params.OutputConfiguration.<init>(OutputConfiguration.java:563)\n\tat android.hardware.camera2.params.OutputConfiguration.<init>(OutputConfiguration.java:404)\n\tat androidx.camera.camera2.internal.compat.params.OutputConfigurationCompatApi33Impl.<init>(OutputConfigurationCompatApi33Impl.java:37)\n\tat androidx.camera.camera2.internal.compat.params.OutputConfigurationCompat.<init>(OutputConfigurationCompat.java:63)\n\tat androidx.camera.camera2.internal.CaptureSession.getOutputConfigurationCompat(CaptureSession.java:385)\n\tat androidx.camera.camera2.internal.CaptureSession.openCaptureSession(CaptureSession.java:309)\n\tat androidx.camera.camera2.internal.CaptureSession.lambda$open$0$androidx-camera-camera2-internal-CaptureSession(CaptureSession.java:221)\n\tat androidx.camera.camera2.internal.CaptureSession$$ExternalSyntheticLambda3.apply(Unknown Source:8)\n\tat androidx.camera.core.impl.utils.futures.ChainingListenableFuture.run(ChainingListenableFuture.java:201)\n\tat androidx.camera.core.impl.utils.executor.SequentialExecutor$QueueWorker.workOnQueue(SequentialExecutor.java:229)\n\tat androidx.camera.core.impl.utils.executor.SequentialExecutor$QueueWorker.run(SequentialExecutor.java:171)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)\n\tat java.lang.Thread.run(Thread.java:1012)\n","message":"Surface was abandoned"})

Camera Device

[
  {
    "formats": null,
    "sensorOrientation": "landscape-left",
    "hardwareLevel": "full",
    "maxZoom": 30,
    "minZoom": 0.4944782853126526,
    "maxExposure": 24,
    "supportsLowLightBoost": true,
    "neutralZoom": 1,
    "physicalDevices": [
      "wide-angle-camera",
      "wide-angle-camera",
      "ultra-wide-angle-camera",
      "telephoto-camera",
      "telephoto-camera",
      "telephoto-camera"
    ],
    "supportsFocus": true,
    "supportsRawCapture": false,
    "isMultiCam": true,
    "minFocusDistance": 10.500000100135805,
    "minExposure": -24,
    "name": "0 (BACK) androidx.camera.camera2",
    "hasFlash": true,
    "hasTorch": true,
    "position": "back",
    "id": "0"
  },
  {
    "formats": null,
    "sensorOrientation": "landscape-right",
    "hardwareLevel": "full",
    "maxZoom": 10,
    "minZoom": 0.8958333134651184,
    "maxExposure": 24,
    "supportsLowLightBoost": true,
    "neutralZoom": 1,
    "physicalDevices": [
      "wide-angle-camera",
      "wide-angle-camera",
      "wide-angle-camera"
    ],
    "supportsFocus": true,
    "supportsRawCapture": false,
    "isMultiCam": true,
    "minFocusDistance": 10,
    "minExposure": -24,
    "name": "1 (FRONT) androidx.camera.camera2",
    "hasFlash": false,
    "hasTorch": false,
    "position": "front",
    "id": "1"
  }
]

Device

Pixel 8 Pro

VisionCamera Version

4.5.2

Can you reproduce this issue in the VisionCamera Example app?

No, I cannot reproduce the issue in the Example app

Additional information

felipejh avatar Sep 23 '24 13:09 felipejh

Guten Tag, Hans here! 🍻

It looks like you’ve reported a possible bug with ze Pixel 8 Pro. However, I see you can't reproduce it in ze example app, which is a great start!

One thing to note is ze error message mentioning "Surface was abandoned." This could indicate a configuration issue. Please try to check your output configurations and make sure they align correctly with your device capabilities.

If you could gather some logs using adb logcat while running your app, it would help mrousavy a lot in diagnosing ze issue properly.

If you need guidance on how to collect those logs, let me know! If you find ze issue persists, please also consider sponsoring ze project to help mrousavy prioritize issues like this: Sponsor mrousavy.

Danke!

Note: If you think I made a mistake, please ping @mrousavy to take a look.

maintenance-hans[bot] avatar Sep 23 '24 13:09 maintenance-hans[bot]

No, I cannot reproduce the issue in the Example app

Sorry but then I guess this is an issue in your app..

mrousavy avatar Sep 25 '24 15:09 mrousavy

No, I cannot reproduce the issue in the Example app

Sorry but then I guess this is an issue in your app..

Thank you for you reply. But I believe another person is facing the same issue here https://github.com/mrousavy/react-native-vision-camera/issues/2862#issuecomment-2366970218.

felipejh avatar Sep 26 '24 18:09 felipejh

Yea I'm sorry but that comment gives even less context. Not even logs. There's nothing I can do at this point if it cannot be reproduced in the example app.

mrousavy avatar Sep 30 '24 18:09 mrousavy

@felipejh Try forcing lowLightBoost to false. I found on Pixel 6 and Pixel 9, this was necessary even though supportsLowLightBoost returns true. No idea why, but worked for me.

JesseLawler avatar Oct 03 '24 17:10 JesseLawler

@felipejh Try forcing lowLightBoost to false. I found on Pixel 6 and Pixel 9, this was necessary even though supportsLowLightBoost returns true. No idea why, but worked for me.

That worked like a charm! 🥇 Thank you!

felipejh avatar Nov 04 '24 19:11 felipejh