natario1 / CameraView

📸 A well documented, high-level Android interface that makes capturing pictures and videos easy, addressing all of the common issues and needs. Real-time filters, gestures, watermarks, frame processing, RAW, output of any size.
https://natario1.github.io/CameraView
Other
4.95k stars 937 forks source link

PictureResult.getData() returns null on some devices after onPictureTaken() in CameraListener() #1168

Open GhassenMsd opened 2 years ago

GhassenMsd commented 2 years ago

Describe the bug

To Reproduce

Expected behavior

XML layout

Part of the XML layout with the CameraView declaration, so we can read its attributes.

<com.otaliastudios.cameraview.CameraView
        android:id="@+id/view_camera"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:cameraAudio="off"
        app:cameraFacing="back"
        app:cameraMode="picture"
        app:cameraPictureFormat="jpeg"
        app:cameraUseDeviceOrientation="false" />

Screenshots

Capture d’écran 2022-05-03 à 09 59 46

Logs

java.lang.NullPointerException · Attempt to get length of null arrayRawCameraUtils:317 com.otaliastudios.cameraview.CameraUtils.decodeBitmapCameraUtils:34 com.otaliastudios.cameraview.CameraUtils.access$000CameraUtils.java:216 com.otaliastudios.cameraview.CameraUtils$2.runHandler.java:938 android.os.Handler.handleCallbackHandler.java:99 android.os.Handler.dispatchMessageLooper.java:226 android.os.Looper.loopOnceLooper.java:313 android.os.Looper.loopHandlerThread.java:67 android.os.HandlerThread.run

qsdigor commented 2 years ago

Similar issue here but this time it is for writing empty data to OutputStream

Fatal Exception: java.lang.NullPointerException: Attempt to get length of null array
       at java.io.FilterOutputStream.write(FilterOutputStream.java:103)
       at com.otaliastudios.cameraview.CameraUtils.writeToFile(CameraUtils.java:93)
       at com.otaliastudios.cameraview.CameraUtils$1.run(CameraUtils.java:121)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:223)
       at android.os.HandlerThread.run(HandlerThread.java:67)