colourmoon / image-picker

This is Library exclusively useful for the image selection from the camera or gallery. Developed by ColourMoon
https://thecolourmoon.com
MIT License
3 stars 0 forks source link

Android 9 or below, the camera does not work properly #2

Closed shaikhaquib closed 6 months ago

shaikhaquib commented 11 months ago

Issue Description:

When working on Android 9 or below, the camera does not work properly. It takes time to initialize, and sometimes it only displays a black screen. Additionally, when we click on capture, the loader keeps loading indefinitely.

Calling:

  imagePicker
            .allowCrop(false)
            .allowCompress(true, 80)
            .allowGalleryOnly(false)
            .allowCameraOnly(true)
            .start()

Logs:

getRelativeImageRotation: destRotationDegrees=0, sourceRotationDegrees=90, isOppositeFacing=true, result=90
17:23:12.957  D  getRelativeImageRotation: destRotationDegrees=0, sourceRotationDegrees=90, isOppositeFacing=true, result=90
17:23:12.961  D  Resolved dynamic range for use case androidx.camera.core.Preview-d84b7d05-7c44-48dd-9669-cd32da2863d0 to no compatible HDR
                 dynamic ranges.
                 DynamicRange@4f4abb8{encoding=UNSPECIFIED, bitDepth=0}
                 ->
                 DynamicRange@2994e1b{encoding=SDR, bitDepth=8}
17:23:12.965  D  getRelativeImageRotation: destRotationDegrees=0, sourceRotationDegrees=90, isOppositeFacing=true, result=90
17:23:12.965  D  Surface created[total_surfaces=1, used_surfaces=0](androidx.camera.core.processing.SurfaceEdge$SettableSurface@b43ce60}
17:23:12.966  D  Surface created[total_surfaces=2, used_surfaces=0](androidx.camera.core.SurfaceRequest$2@f87708c}
17:23:12.967  D  New surface in use[total_surfaces=2, used_surfaces=1](androidx.camera.core.SurfaceRequest$2@f87708c}
17:23:12.967  D  use count+1, useCount=1 androidx.camera.core.SurfaceRequest$2@f87708c
17:23:12.968  D  getRelativeImageRotation: destRotationDegrees=0, sourceRotationDegrees=90, isOppositeFacing=true, result=90
17:23:12.970  D  createPipeline(cameraId: 0, streamSpec: StreamSpec{resolution=1280x960, dynamicRange=DynamicRange@2994e1b{encoding=SDR, bitDepth=8}, expectedFrameRateRange=[0, 0], implementationOptions=androidx.camera.camera2.impl.Camera2ImplConfig@a810978})
17:23:12.972  D  Surface created[total_surfaces=3, used_surfaces=1](androidx.camera.core.impl.ImmediateSurface@4a3c851}
17:23:12.983  D  {Camera@462271f[id=0]} Use case androidx.camera.core.ImageCapture-399fd3eb-8049-4d40-9378-60c5597582b4166587933 ACTIVE
17:23:12.983  D  Active and attached use case: [] for camera: 0
17:23:12.985  D  {Camera@462271f[id=0]} Use case androidx.camera.core.Preview-d84b7d05-7c44-48dd-9669-cd32da2863d0165689076 ACTIVE
17:23:12.985  D  Active and attached use case: [] for camera: 0
17:23:12.988  D  {Camera@462271f[id=0]} Use case androidx.camera.core.ImageCapture-399fd3eb-8049-4d40-9378-60c5597582b4166587933 ACTIVE
17:23:12.988  D  Active and attached use case: [] for camera: 0
17:23:12.988  D  Active and attached use case: [] for camera: 0
17:23:12.989  D  {Camera@462271f[id=0]} Use cases
                 [androidx.camera.core.Preview-d84b7d05-7c44-48dd-9669-cd32da2863d0165689076, androidx.camera.core.ImageCapture-399fd3eb-8049-4d40-9378-60c5597582b4166587933] now
                 ATTACHED
17:23:12.990  D  All use
                 case: [androidx.camera.core.ImageCapture-399fd3eb-8049-4d40-9378-60c5597582b4166587933, androidx.camera.core.Preview-d84b7d05-7c44-48dd-9669-cd32da2863d0165689076] for
                 camera: 0
17:23:12.990  D  mMeteringRepeating is ATTACHED, SessionConfig Surfaces: 2, CaptureConfig Surfaces: 1
17:23:12.991  D  Active and attached use
                 case: [androidx.camera.core.ImageCapture-399fd3eb-8049-4d40-9378-60c5597582b4166587933, androidx.camera.core.Preview-d84b7d05-7c44-48dd-9669-cd32da2863d0165689076] for
                 camera: 0
17:23:12.999  D  {Camera@462271f[id=0]} Resetting Capture Session
17:23:13.001  D  {Camera@462271f[id=0]} Releasing session in state INITIALIZED
17:23:13.004  D  {Camera@462271f[id=0]} Attempting to force open the camera.
17:23:13.005  D  tryOpenCamera(Camera@462271f[id=0]) [Available Cameras: 1, Already Open: false (Previous state: CLOSED)] --> SUCCESS
17:23:13.005  D  Recalculating open cameras:
                 Camera                                       State                 
                 -------------------------------------------------------------------
                 Camera@5b23396[id=1]                         UNKNOWN               
                 Camera@462271f[id=0]                         OPENING               
                 -------------------------------------------------------------------
                 Open count: 1 (Max allowed: 1)

Please investigate and resolve this issue.

https://imgur.com/n93ch5w

Image Description

shaikhaquib commented 10 months ago

is this repository still active?

ronilgwalnai commented 6 months ago

Hi shaikhaquib

It's nice to hear that you found an issue. I have checked it in the applications and made some corrections. It's working fine on all the devices in which I have tested. I request you to check the latest version of the library, which is "com.github.colourmoon:image-picker:v1.0.3". If you continue to face this issue, just let me know here, or you can contact me. My GitHub and email details are available publicly.

I hope I have rectified your issue.