DelphiWorlds / Kastri

Cross-platform library for Delphi
MIT License
498 stars 119 forks source link

[Camera] Demo crashes / hangs after clicking the start button #20

Closed Elinulok32 closed 3 years ago

Elinulok32 commented 3 years ago

Hello, thank you so much for adding this great camera component. I'm testing the camera demo on android 10, using Delphi 10.3.3. The demo compiles and install well on my android phone but crashes or hangs as soon as I click on the start button. At the first time of install it crashes after you grant permission to use camera and on subsequent runs it crashes just after clicking the start button.

Also, it was only able to compile and installed well, because I ignored the errors: "Error reading LocationSensor.ActivityType: Property ActivityType does not exist" and "Error reading LocationSensor.UsageAuthorization: Property UsageAuthorization does not exist" while opening the CD.View.Main.pas file in the IDE

Please is there anything I'm doing wrong? Thank you.

DelphiWorlds commented 3 years ago

You're not doing anything wrong - it crashes for me too when compiling with 10.3.3. At the moment I can only suggest using 10.4.1. This may take some time to resolve.

Elinulok32 commented 3 years ago

Thank you very much for your rapid response. I will consider your suggestion. Thank you

DelphiWorlds commented 3 years ago

For my own reference, this seems to be semi-related:

https://stackoverflow.com/questions/41388376/surfaceview-surface-had-no-valid-native-window-android-camera-api-hardwa

marlonnardi commented 3 years ago

To contribute, so does Delphi 10.4.1 () Samsung Galaxy A21s Android 10

Log Delphi Project CameraDemo.apk raised exception class EReadError with message 'Stream read error'.

Log Android Studio 2020-11-17 16:44:54.011 25457-25489/com.embarcadero.CameraDemo I/CameraManagerGlobal: Camera 0 facing CAMERA_FACING_BACK state now CAMERA_STATE_ACTIVE for client com.embarcadero.CameraDemo API Level 2 2020-11-17 16:44:59.918 25457-25457/com.embarcadero.CameraDemo D/ViewRootImpl@dfb870e[FMXNativeActivity]: ViewPostIme pointer 0 2020-11-17 16:45:00.078 25457-25457/com.embarcadero.CameraDemo D/ViewRootImpl@dfb870e[FMXNativeActivity]: ViewPostIme pointer 1 2020-11-17 16:46:56.842 25457-25540/com.embarcadero.CameraDemo I/dero.CameraDem: Waiting for a blocking GC ProfileSaver 2020-11-17 16:47:00.819 25457-25577/com.embarcadero.CameraDemo D/SurfaceView: onWindowVisibilityChanged(8) false com.embarcadero.firemonkey.form.FormView{a6d061a VFE...... ......I. 0,0-0,0} of ViewRootImpl@dfb870e[FMXNativeActivity] 2020-11-17 16:47:00.822 25457-25577/com.embarcadero.CameraDemo W/System.err: android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. 2020-11-17 16:47:00.822 25457-25577/com.embarcadero.CameraDemo W/System.err: at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:9816) 2020-11-17 16:47:00.822 25457-25577/com.embarcadero.CameraDemo W/System.err: at android.view.ViewRootImpl.requestLayout(ViewRootImpl.java:1845) 2020-11-17 16:47:00.822 25457-25577/com.embarcadero.CameraDemo W/System.err: at android.view.View.requestLayout(View.java:26338) 2020-11-17 16:47:00.823 25457-25577/com.embarcadero.CameraDemo I/chatty: uid=10230(com.embarcadero.CameraDemo) CameraPreview identical 1 line 2020-11-17 16:47:00.823 25457-25577/com.embarcadero.CameraDemo W/System.err: at android.view.View.requestLayout(View.java:26338) 2020-11-17 16:47:00.823 25457-25577/com.embarcadero.CameraDemo W/System.err: at android.view.ViewGroup.removeView(ViewGroup.java:6190) 2020-11-17 16:47:00.823 25457-25577/com.embarcadero.CameraDemo W/System.err: at com.embarcadero.rtl.ProxyInterface.dispatchToNative(Native Method) 2020-11-17 16:47:00.823 25457-25577/com.embarcadero.CameraDemo W/System.err: at com.embarcadero.rtl.ProxyInterface.invoke(ProxyInterface.java:21) 2020-11-17 16:47:00.823 25457-25577/com.embarcadero.CameraDemo W/System.err: at java.lang.reflect.Proxy.invoke(Proxy.java:1006) 2020-11-17 16:47:00.824 25457-25577/com.embarcadero.CameraDemo W/System.err: at $Proxy20.onImageAvailable(Unknown Source) 2020-11-17 16:47:00.824 25457-25577/com.embarcadero.CameraDemo W/System.err: at android.media.ImageReader$ListenerHandler.handleMessage(ImageReader.java:798) 2020-11-17 16:47:00.824 25457-25577/com.embarcadero.CameraDemo W/System.err: at android.os.Handler.dispatchMessage(Handler.java:107) 2020-11-17 16:47:00.824 25457-25577/com.embarcadero.CameraDemo W/System.err: at android.os.Looper.loop(Looper.java:237) 2020-11-17 16:47:00.824 25457-25577/com.embarcadero.CameraDemo W/System.err: at android.os.HandlerThread.run(HandlerThread.java:67) 2020-11-17 16:47:01.061 25457-25485/com.embarcadero.CameraDemo I/dero.CameraDem: Background concurrent copying GC freed 446(89KB) AllocSpace objects, 6(1032KB) LOS objects, 49% free, 3800KB/7601KB, paused 66us total 120.229s 2020-11-17 16:47:01.062 25457-25540/com.embarcadero.CameraDemo I/dero.CameraDem: WaitForGcToComplete blocked ProfileSaver on ProfileSaver for 4.219s 2020-11-17 16:47:01.071 25457-25577/com.embarcadero.CameraDemo D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000

DelphiWorlds commented 3 years ago

@marlonnardi What you've reported is actually a new issue. Please refer to: https://github.com/DelphiWorlds/Kastri/issues/24

DelphiWorlds commented 3 years ago

To clarify, the crash happens when using Delphi 10.3.3, and causes this exception: EJINIException java.lang.IllegalArgumentException: Surface was abandoned I am yet to find a solution for it.

tiagoomoreira commented 3 years ago

Dear, I look forward to a solution to this problem. My App depends a lot on your camera. In advance I thank you for existing. I would like to participate in your project! I used the example of EXIF's for reading and ended up finding how to write EXIFs as well. It is a pity that Delphi does not care about these features. I also need a way to record videos taking the exact moment when the recording starts. I am studying alternatives for this.

DelphiWorlds commented 3 years ago

Unfortunately, I was unable to resolve this issue. Now that Delphi 10.4.2 Community Edition has been released, I am closing the issue, and advise users to upgrade

Elinulok32 commented 3 years ago

Well noted and thank you so much. I'll upgrade to 10.4.2.


From: DelphiWorlds @.> Sent: Tuesday, July 20, 2021 7:10 AM To: DelphiWorlds/Kastri @.> Cc: Elinulok32 @.>; Author @.> Subject: Re: [DelphiWorlds/Kastri] [Camera] Demo crashes / hangs after clicking the start button (#20)

Unfortunately, I was unable to resolve this issue. Now that Delphi 10.4.2 Community Edition has been released, I am closing the issue, and advise users to upgrade

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/DelphiWorlds/Kastri/issues/20#issuecomment-883151679, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALMXUYMOJ7MA7JOLELGRI7DTYUOOZANCNFSM4TR7ADVQ.