Closed victorkvarghese closed 4 months ago
@mrousavy
I think this is related to s23 ultra. I was able to run this properly in an Oppo v27 pro. I ran the example project disabling frame processors.
Not sure if this will help. Adding for clarity
Might be related: https://github.com/mrousavy/react-native-vision-camera/issues/1801#issuecomment-1719943232
I will check removing lines
@mrousavy hope this helps
Thing are working after removing those lines of code. I tried adding them one by one.
Device: S23 Ultra Android Version: 13
Switching from back camera to front camera crashed when i added zoom related piece of code.
react-native-vision-camera/package/android/src/main/java/com/mrousavy/camera/core/CameraSession.kt
// Zoom
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
captureRequest.set(CaptureRequest.CONTROL_ZOOM_RATIO, zoom)
} else {
val cameraCharacteristics = cameraManager.getCameraCharacteristics(cameraId!!)
val size = cameraCharacteristics.get(CameraCharacteristics.SENSOR_INFO_ACTIVE_ARRAY_SIZE)!!
captureRequest.set(CaptureRequest.SCALER_CROP_REGION, size.zoomed(zoom))
}
One of the errors i got was
java.lang.IllegalArgumentException: getCameraCharacteristics:1043: Unable to retrieve camera characteristics for unknown device 1: No such file or directory (-2)
Thanks for trying the other approach though, I think we can pinpoint this to the zoom here - maybe Samsung can't handle non-clamped zoom values? What if you pass something like 0.5
or 1
here in that prop?
Sorry for the multiple number of messages/tags.
I have attached what i could salvage from android studio. (Not able to get the entire logcat)
not sure, I will check and get back. Im using same code as the example folder. App crashes when switching the camera, not when zooming happens.
will pass the prop and get back
Hi,
i tried to log the zoom.value.
neutral zoom value is 1 for both back and front camera
I trying to see if there is a way to reset zoom to preferred value when camera position changes. Not sure if this is a reanimated issue that's causing the camera to have an unsupported value
Update
Fix 1 with reanimated zoom
I passed zoom={1} as a prop. And i think issues got fixed. App is not breaking when user zooms in/out. I think without zoom prop app crashes when cameras are switched
PS: Max zoom/min zoom is not proper. Think max zoom is 10 but it should be 100
Fix 2:
Remove reanimated zoom gesture and use enableZoomGesture={true}
Zoom gesture is not great, but u can zoom 100x
Okay so we need to clamp zoom
Do we need to add any permissions for flash. I tried 3 different devices , flash is not working on any of them.
HDR is also crashing for me.
Flash is not yet implemented in V3. there is a feature request for that.
HDR is crashing; please create a separate bug report and share the logs.
i also get this issue in Samsung devices, just a black screen on Camera view
i also get this issue in Samsung devices, just a black screen on Camera view
@xts-bit try const devices = useCameraDevices() and check if any cameras are detected.
@victorkvarghese It didn't work black screen on V3.1
Same issue... any fixes?
Hey!
Quick update: I think there could be four problems here:
limited
/legacy
device, and use Preview (always on), photo
and video
/frameProcessor
outputs (3 outputs) which are by default at maximum resolution. LIMITED/LEGACY devices might not support full-resolution streaming, see the Android capture session documentation on supported configuration maps.
We need PRIV PREVIEW
+ YUV/PRIV RECORD
+ JPEG MAXIMUM
. anything lower, needs to be explicitly handled by me, but I can easily add that no problemo. I just need the device to test it on.
What you can do: Try disabling photo
, video
and frameProcessor
and check if that works. If only PREVIEW is attached, everything should work.getPreviewCaptureRequest
and see what happens. I've heard zoom
is often the cause.@mrousavy Make sense I am using "fps={60}" prop in my Camera. However, V2 works fine.
Hey! Can anyone try with VisionCamera 3.4.1. and see if the issue still persists? Thanks!
@xts-bit does it work if you remove those lines in CameraSession.kt
?
@mrousavy
I just checked in S23 Ultra. v3.4.1
Hey! Did #2049 (released in 3.6.0) fix the HDR issue? Thanks!
Hi @mrousavy i tested the latest code with S23 ultra.
front camera is kind of stretched out , weird aspect ratio. I tried commenting all aspect ratio related code, but same results
I had same issue with back camera. But it got resolved when i commented everything in format
Camera hangs up when HDR is turned on with the exception
com.mrousavy.camera.core.CameraSessionCannotBeConfiguredError: [session/cannot-create-session] Failed to create a Camera Session for Camera 0!
// const screenAspectRatio = SCREEN_HEIGHT / SCREEN_WIDTH;
const format = useCameraFormat(device, [
// { fps: targetFps },
// { videoAspectRatio: screenAspectRatio },
// { videoResolution: 'max' },
// { photoAspectRatio: screenAspectRatio },
// { photoResolution: 'max' },
]);
I tested with another vivo device. Front and back camera is working alright without providing aspect ratio
Update: things are fine if i downgrade to 3.4.1 , Front camera is not stretched out
Okay so there is some wrong stretching going on in the preview? cc @blancham is that something you noticed as well?
I think this is also related: https://github.com/mrousavy/react-native-vision-camera/issues/2123
Have the same issue. front camera photos are horizontal oriented, while back camera is working okay.
I'm still facing the same issue. I opened the example app and repeated flipping the direction. My device is a Galaxy S10, Android 12.
logs: https://gist.github.com/bglgwyng/4b287419ff61a02d7c09efb9a53e8cad
Unable to retrieve camera characteristics for unknown device 1: No such file or directory (-2)
Lol that is a weird error.
This has been reported by a few people on the internet and seems to be a device manifacturer error, e.g.: https://www.reddit.com/r/Xiaomi/comments/wtytkp/my_camera_keeps_on_crashing/
I had an issue with com.mrousavy.camera.core.CameraSessionCannotBeConfiguredError: [session/cannot-create-session] Failed to create a Camera Session for Camera 0!
This only happens to the users who are using Samsung S23
I tried to replicate the issue and got the log
02-02 15:38:13.056 10536 11563 W CameraDevice-JV-0: Stream configuration failed due to: createSurfaceFromGbp:482: Camera 0: No 10-bit supported stream configurations with format 0x21 defined and profile 2, failed to create output stream
02-02 15:38:13.058 10536 11563 E CameraCaptureSession: Session 0: Failed to create capture session; configuration failed
02-02 15:38:13.058 10536 11563 E CreateCaptureSession: Camera #0: Failed to create CameraCaptureSession #1!
02-02 15:38:13.058 10536 11563 E CameraSession: Failed to configure CameraSession! Error: [session/cannot-create-session] Failed to create a Camera Session for Camera #0!, isRunning: false, Config-Diff: Difference(deviceChanged=true, outputsChanged=true, sidePropsChanged=true, isActiveChanged=true)
02-02 15:38:13.058 10536 11563 E CameraSession: pl.k: [session/cannot-create-session] Failed to create a Camera Session for Camera #0!
So the problem is CameraDevice-JV-0: Stream configuration failed due to: createSurfaceFromGbp:482: Camera 0: No 10-bit supported stream configurations with format 0x21 defined and profile 2, failed to create output stream
I can fix the problem by setting the photoHdr={false}
@ben-qiu does your format
even have supportsPhotoHdr
?
@ben-qiu does your
format
even havesupportsPhotoHdr
?
Hi @mrousavy , I didn't log the value, but I believe it is true
, because the original code was photoHdr={format.supportsPhotoHdr}
Okay yea makes sense.
I've occasionally observed this behavior with VisionCamera 3.8.2 on Galaxy S21. However, after upgrading to version 3.9.0, now I consistently experience this behavior.
@bglgwyng wow - weird. Can you show me how you're using the <Camera>
component, and also the adb logcat logs?
If you are using a Frame Processor, maybe it's this change? https://github.com/mrousavy/react-native-vision-camera/compare/v3.8.2...v3.9.0-beta.0#diff-2335891be153a7966add00cea63f840e8c3c5597af11fb9f7156dac0d1fb57b1R84-R87
Could you try to disable a Frame Processor and see if that works? Also, maybe try explicitly passing a different format? Either native
or yuv
What's happening?
@mrousavy I tried the latest v3 example code. By default front camera is loading in s23 ultra.
Then i removed everything and made it
const devices = useCameraDevices();
now back camera loads, but switching to front crashes the app.now if i use
const device = useCameraDevice(cameraPosition, { physicalDevices: [ 'ultra-wide-angle-camera', 'telephoto-camera', 'wide-angle-camera', ], });
i can see front camera. but unable to switch back to Back Camera
now if i go back to the old code and refresh the app. Then both cameras work. But if i close the app open it again, back camera will work, but front camera will fail
Reproduceable Code
Relevant log output
{ [session/camera-has-been-disconnected: [session/camera-has-been-disconnected] The given Camera device (id: 1) has been disconnected! Error: UNKNOWN_CAMERA_DEVICE_ERROR] name: 'session/camera-has-been-disconnected',
Device
S23 Ultra Android
VisionCamera Version
3.1.0
Can you reproduce this issue in the VisionCamera Example app?
Yes I can
Additional information