B4A Library Freeware Advanced Audio (AAC) Decoder for Android

Pendrush

Well-Known Member
Licensed User
Now you are able to play AAC radio streams in background (as a Service).
This is not a wrapper, but usage of JavaObject to expose Events and Classes from library.
You can also create wrapper from B4a alone.

Copy aacdecoder-android-0.8.jar from LIBRARY folder into your "Additional libraries" folder or in B4A "Libraries" folder.

aacdecoder-android-0.8.jar
Library info 1: https://code.google.com/p/aacdecoder-android/
Library info 2: https://github.com/vbartacek/aacdecoder-android

This is mainly for decoding AAC streams, you can also decode MP3/MPEG but player sometimes will not play and in log you will see error
PlayerCallback_Event - playerException(1): java.lang.IllegalArgumentException: Invalid audio buffer size.
Check https://code.google.com/p/aacdecoder-android/issues/detail?id=66
I have 1 error in 100 runs for MP3/MPEG decoding. You can also catch this error and force player restart as a workaround.
No errors in AAC decoding.
You can always use native player for MP3/MPEG and this player for AAC only.

Add to your manifest
AddPermission(android.permission.INTERNET)

EDIT:
Project attached to post.

EDIT2:
Attached aacdecoder-android-0.8.jar with some bug fixes
 

Attachments

Last edited:

Informatix

Expert
Licensed User
Now you are able to play AAC radio streams in background (as a Service).
This is not a wrapper, but usage of JavaObject to expose Events and Classes from library.
You can also create wrapper from B4a alone.

Copy aacdecoder-android-0.8.jar from LIBRARY folder into your "Additional libraries" folder or in B4A "Libraries" folder.

aacdecoder-android-0.8.jar
Library info 1: https://code.google.com/p/aacdecoder-android/
Library info 2: https://github.com/vbartacek/aacdecoder-android

This is mainly for decoding AAC streams, you can also decode MP3/MPEG but player sometimes will not play and in log you will see error
PlayerCallback_Event - playerException(1): java.lang.IllegalArgumentException: Invalid audio buffer size.
Check https://code.google.com/p/aacdecoder-android/issues/detail?id=66
I have 1 error in 100 runs for MP3/MPEG decoding. You can also catch this error and force player restart as a workaround.
No errors in AAC decoding.
You can always use native player for MP3/MPEG and this player for AAC only.

Add to your manifest
AddPermission(android.permission.INTERNET)

Inside attached file AAC_and_MP3_Stream_Decoding.txt is download link.
To shrink this library, one can remove the /lib/mips folder inside the jar. AFAIK, the number of Android devices with the concerned architecture is next to none.
 

Syd Wright

Well-Known Member
Licensed User
Wow, this player is incredibly fast. I added a MediaPlayerStream (MP) to compare. The AAC player starts almost instantly (with an mp3 radio stream: "http://mediaserv33.live-streams.nl:8058/;stream/1") whereas MP takes nearly 2 seconds.

With this stream the difference is even more significant: 0.5 seconds versus 15 seconds:
http://listen.radionomy.com/radio-vdm-radioplayer?type=.mp3/;stream.mp3

What I also like very much is that the player shows the station name and in particular the current song title and artist that a radio station is playing (both with AAC and MP3 streams).
Well done! This player deserves a far more prominent exposure on the B4A forum.
 
Last edited:

Syd Wright

Well-Known Member
Licensed User
I sometimes get this error which causes my app to crash:

java.lang.NullPointerException
at com.spoledge.aacdecoder.PCMFeed.run(PCMFeed.java:420)
at java.lang.Thread.run(Thread.java:841)


in particular when trying to play streams that are not always active, like with ATC airport stations (e.g: http://d.liveatc.net/ehrd at Rotterdam airport). I cannot find where this error occurs. Can the error be intercepted?

Note: It does not seem to be necessary to add
AddPermission(android.permission.INTERNET) to the manifest
 
Last edited:

Syd Wright

Well-Known Member
Licensed User
is there a way to adjust the volume of this AAC player (independent of the system volume)?
I want to reduce the volume while my app is announcing the title and artist of the current song that is playing.

PS: Please don't tell me to use Exoplayer :)
 
Top