jmpessoa / lazandroidmodulewizard

LAMW: Lazarus Android Module Wizard: Form Designer and Components development model!
248 stars 82 forks source link

loading video and audio from Internet native assertion crashes #27

Open JanuszChmiel opened 7 years ago

JanuszChmiel commented 7 years ago

Dear specialists, I AM running latest stable laz4android. I Am running latest available lazandroidmodulewizard-master branch. When I want to try yours provided sample demo load image and video from Internet, I Am occurring native crashes and Java virtual machine exception. Here is one bug produced by Java virtual machine. When i want to switch from one live stream to other. 09-03 12:54:37.968: A/art(8581): art/runtime/java_vm_ext.cc:440] JNI DETECTED ERROR IN APPLICATION: thread Thread[18,tid=8656,Native,Thread=0xb92756c0,peer=0x12d40fa0,"AsyncTask #2"] using JNIEnv from thread Thread[18,tid=8656,Native,Thread*=0xb92756c0,peer=0x12d40fa0,"AsyncTask #2"]

And one of The clean C native crash. 09-02 15:05:58.555: A/libc(31960): Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 32005 (AsyncTask #1) I AM visually impaired with no sight at all. But I Am very nicely impressed by yours project. It reduces number of .pas source code lines, which developer must write to use yours development model and GUI interface. I want to help you debugging. If I can help you debugging, please give me some instructions. Please also be aware, that build in modern Samsung mobile phone energy saving feature prevent yours background function to run if USB charger have been disconnected from The phone. So Internet radio play stop when screen have been turned off by using power button and if charger is not connected. I Am suggest you to use wakelock feature. And unfortunately, Yours sample based on component to play video or sound from The internet can not be used on Android 4.1.2. Any instructions, advices are very welcomed. I want to help you.

r1me commented 7 years ago

I assume the demo you've mentioned is AppLoadImageVideoSoundFromInternet. I just tried it. I can confirm that all URLs in it are valid but pressing Image button makes the application crash. Switching between Sound and Video option seems to be stable. I believe Jose will have a look at this issue and solve it soon. PS. Yes, LAMW is awesome for small projects :+1:

JanuszChmiel commented 7 years ago

Dear, For example, try to use following two links. One for loading sound and one for loading video. It is even possible to use also sound live stream for part of The code for managing video playback from The Internet. So two streams of our Czech radio stations. http://icecast8.play.cz/cro1-128.mp3 http://icecast6.play.cz/cro2-128.mp3 Sure, I Am aware, that Internet multimedia support is very complex and that there are many various mobile phones with various hydden bugs of their firmwares. Thank you very much for yours time and for this project. App some times crash if I want to load live stream for The first time. It is always producing native crash some signal. And if one stream is switched to other, while previous is being played. May be, that when internal Lazarus wizard component shows please wait message, that loop which detect if this message should be presented or no is causing thread overload. But I will rather lett it on The experts. I Am ready to test new sample or whole package after somebody of us will change it. Thank you very much for yours patience.

r1me commented 7 years ago

I can suggest switching from LAMW components wrappers to something designed specifically for audio playback from Internet radio. I just created a project using LAMW and BASS Audio Library. Source code is available at https://github.com/r1me/LAMWBassStreamPlayback The project was made and intended to be used with Android 4.0+ devices with ARMv6 or compatible processor. In center of the screen there are three buttons, pressing one of first two will play live stream from your URLs. Last button will stop playback. I predict some issues in building my code due to different Android SDK etc. paths. Precompiled APK can be found in bin\BassStreamPlayback-release.apk. If you experience issues with my project please open an issue at https://github.com/r1me/LAMWBassStreamPlayback/issues

JanuszChmiel commented 7 years ago

Dear Damian, Really excellent programmers work. Yours algorithm is even much more faster. I had to wait 8 9 seconds even while using most modern Android devices before some station have been loaded. I will use yours code even for my personal needs, do not be afraid. And I will extend The GUi to support all available Czech radios. Because official app made by our State radio is not supporting so much devices. I will also learn coding by extending yours GUI. I will have to use Akelpad, because I can not use Lazarus form designer mode as a visually impaired developer with no sight at all. But I will do my best to successfully find some solution, which will also enable me to develop in this perfect language and IDE like other sighted Pascal developers. Sure, my fight and way will not be easy. I can not simply move GUI components from Android bridge to my project by using mouse movements. So very well done and thank you very much for yours professional work. I AM Pascal beginner. Do you know, how to prevent Lazarus android wizard to include .bak files with Java source code of interface library to The resulting .apk file? I have been afraid, that those .bak files are internally needed by The compiled apks. Fortunately it is not true.

jmpessoa commented 7 years ago

Hello Janusz! I will Try fix "AppLoadImageVideoSoundFromInternet"

Hello r1me! Great 'LAMWBassStreamPlayback"! Congratulations!

Thanks to All!

JanuszChmiel commented 7 years ago

Dear specialists, I Am thinking about Radio app. What about try to use asinc task? Include on backgrount process? Because Android display bug that app has stopped also because some tasks must be executed asynchronously. Especially while initializing live streams, since.

  1. buffer have to be filled by data before component Media android can play stream. It is also question, how much you can control from The perspective of The developer of Lamw components, which are being called. Would you try to modify app loadimages and sound from Internet, so crucial task will be executed on background? Similarly, like asynctask demo is developed? May be, that it is non sense, I do not know so much about Delphi and object Pascal like you know. I Am only thinking about The possible solution.

Lamw has manyof its other functions perfect and with no bugs at all. If i were sighted, I would even be very nicely impressed because of its form designer model. So if it would be possible, please try to think about it if you will have some time on future. I Am ready to debug new changes, even rebuild Lazarus with newly updated Lamw components. I Am patient. Thank you very much for yours understanding and for yours development time. I know, that it is not easy.