B4A Library Freeware Advanced Audio (AAC) Decoder for Android

Discussion in 'Additional libraries, classes and official updates' started by Pendrush, Oct 22, 2015.

  1. Pendrush

    Pendrush Active 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.

    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

    Project attached to post.

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

    Attached Files:

    Last edited: Jan 19, 2017
  2. Informatix

    Informatix Expert Licensed User

    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.
  3. Pendrush

    Pendrush Active Member Licensed User

    Last edited: Oct 22, 2015
    DonManfred and lemonisdead like this.
  4. Syd Wright

    Syd Wright Active 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:

    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: Apr 21, 2017
  5. Syd Wright

    Syd Wright Active Member Licensed User

    I sometimes get this error which causes my app to crash:

    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: Apr 22, 2017
  6. tuhatinhvn

    tuhatinhvn Active Member Licensed User

    i want play mp3 online , but i can not seek position, how can i fix it??
  7. moster67

    moster67 Expert Licensed User

    Not with all online streams it is possible...
  8. Syd Wright

    Syd Wright Active 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 :)