-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃悰 takePhoto() generate a fully green image - An unknown error occurred while creating the Camera Session, but the Camera can recover from it #2686
Comments
Did you try to reproduce that in the example app on the |
i get an issue to on xiamoy and realmi device, the screen si black and showing this error working on another devices this is my code
|
+1 I'm getting this error on Google Pixel 3 just simply pressing a button that issues a takePhoto() "errorType": "CameraRuntimeError",
"title": "session/recoverable-error",
"message": "An unknown error occurred while creating the Camera Session, but the Camera can recover from it.", Doing nothing fancy just like example app: const takePhotoOptions = useMemo<TakePhotoOptions>(
() => ({
photoCodec: "jpeg",
flash,
quality: 90,
enableShutterSound: false,
}),
[flash],
)
const takePhoto = useCallback(async () => {
try {
if (camera.current == null) throw new Error("Camera ref is null!")
const photo = await camera.current.takePhoto(takePhotoOptions)
onMediaCaptured(photo, "photo")
} catch (error) {
reportCrash({ error, method: "takePhoto", component: "CaptureButton" })
}
}, [camera, onMediaCaptured, takePhotoOptions]) CameraScreen: const onMediaCaptured = useCallback(
async (media: PhotoFile | VideoFile, type: "photo" | "video") => {
console.log(`Media captured! ${JSON.stringify(media)}`)
},
[],
) It's getting thrown from the Camera's Edit: It only happens on my Android front camera (back camera seems to work fine). @mrousavy It's happening with your Shadowlens app too using the android front camera for Google Pixel 3. Records video fine, just the take photo. |
will push a new beta soon hopefully that fixes this |
Thanks @mrousavy. I did post a bug request here: https://issuetracker.google.com/issues/332350593 per your request. They did send me a demo test app apk to try out, which I plan on doing when I get off work. #2577 (comment) |
@mrousavy I tested the camera freezing issue on the test app that they provide and it seems to work fine on that app. That sort of rules out the issue being with the package Android camera package. |
I can reproduce this issue on my Samsung Tab A8 with the 4.0.0beta15 aswell. |
@SveBo @ChristopherGabba you can just play around with the settings used in Try to tweak those values, rebuild, and see if that changes anything. |
@mrousavy In my case (Samsung Tab A8) updating CameraX to 1.4.0-alpha05 fixed the problem for me. This seems to be a bug with some Samsung devices generating too large images. |
Could you build alpha05? I couldn't build it and get errors.. |
I just changed the react-native-vision-camera/android/build.gradle to "def camerax_version = "1.4.0-alpha05", It did build for me and swapping the camerax_version seems to fix the camera issue. edit: im still on react-native-vision-camera-4.0.0-beta.15 |
hm, weird - the CI also fails to build: #2779 |
Mhm.. I have to check later with the example... but maybe it is the Gradle Version? |
This seems to work for me #2788 |
On an interesting side note, I am not sure yet how relevant this is: On camerax1.4.0-alpha04 the error / green image only occures if there is no frameprocessor set in the react part. (Samsung is working fine on 1.4.9-alpha 5, but I got feedback that Lenovo Tab P11 is not working, but I can not confirm that reliable) |
Hello! |
@mrousavy I found the fix for the Lenovo Tab 11 now as well. The VisionCamera prop has CameraX says this falls back to CAPTURE_MODE_MINIZE_LATENCY if the device doesn't support ZSL. This does not seem to work correctly in this case. |
Yea just set it to quality or speed instead until Google fixes this bug in CameraX |
Thanks again for the V4 release, its way more stable now on Android 馃憤 |
great to hear 馃挭 |
I have a similar problem, I was on version 3.6 but I had the streched view camera error, I tried updating to v4 to resolve it but now I have a new problem with the camera view when open and launch the camera, it turns a green background and after a few seconds the camera freezes, this is shown in the logcats: E 'Camera.onError(session/recoverable-error): An unknown error occurred while creating the Camera Session, but the Camera can recover from it.', { [session/recoverable-error: An unknown error occurred while creating the Camera Session, but the Camera can recover from it.] |
Current devices I have noticed experiencing this are: Some get a black screen, other's get the green screen. I will start debugging where/why they are receiving "recoverable" error. |
I can confirm that setting the photoQualityBalance prop to "speed" instead of its default value of "balanced", has helped resolve the black and green screens reported on the above devices 馃憤 |
@ChristopherGabba @dragonmaster784 could you do me a favor and report that to the Google CameraX team? It's clearly a bug - the doc of the ZSL option (which is what "balanced" is essentially) say that it will fall-back to not use ZSL, but it doesn't apparently - and fails when used in combination with video or ImageAnalysis. Would be great if you could either tell them that in a new issue report or in the one @ChristopherGabba already created. Thanks! |
I also posted an issue report, but it seems like, they can not reproduce it? |
I thought this only happens when also using a Video/ImageAnalysis output, no? Or does this just happen with photo={true}, nothing else? @SveBo Maybe worth adding that detail for them. |
Hey - just created a PR to temporarily fix this - can you test if that works for you? #2897 馃檹 |
I am not reproducing this issue on a device that was previously showcasing it (Samsung galaxy tab A8) using the version 4.0.5 馃憤 |
What's happening?
Question
I'm using react-native-vision-camera: 4.0.0-beta.10, react-native: 0.72.6 (Target SDK has been upgraded to 34).
Device is : Samsung TAB A8 (Android 14)
My code is based on the one provided in the example App (pretty much a copy paste).
Just removed the qualityPrioritization has it not available in the method anymore.
What would be the issue?
When I try to take the picture it gives me the following error :
[session/recoverable-error: An unknown error occurred while creating the Camera Session, but the Camera can recover from it.]
This shows when being in portrait and landscape, in both case it results in generating a fully green image instead of the correct picture :
What I tried
Tried to enable precapture on Android
Reproduceable Code
Relevant log output
Camera Device
Device
Samsung TAB A8 (Android 14)
VisionCamera Version
4.0.0-beta.10
Can you reproduce this issue in the VisionCamera Example app?
No, I cannot reproduce the issue in the Example app
Additional information
The text was updated successfully, but these errors were encountered: