AACDecoder Android - Unable to start native decoder

I am developing an application with this library for playing a radio service: https://code.google.com/p/aacdecoder-android/

A service is a live Shoutcast streaming that points to a .pls file. It works great with my Nexus 4 and some Samsung devices that I tried, but I ran into the following error with an Alcatel phone:

03-31 12:17:56.460: E/AACPlayer(8213): java.lang.RuntimeException: Cannot start native decoder
03-31 12:17:56.460: E/AACPlayer(8213):  at com.spoledge.aacdecoder.Decoder.start(Decoder.java:237)
03-31 12:17:56.460: E/AACPlayer(8213):  at com.spoledge.aacdecoder.AACPlayer.playImpl(AACPlayer.java:424)
03-31 12:17:56.460: E/AACPlayer(8213):  at com.spoledge.aacdecoder.AACPlayer.play(AACPlayer.java:386)
03-31 12:17:56.460: E/AACPlayer(8213):  at com.spoledge.aacdecoder.AACPlayer.play(AACPlayer.java:338)
03-31 12:17:56.460: E/AACPlayer(8213):  at com.spoledge.aacdecoder.AACPlayer$1.run(AACPlayer.java:296)
03-31 12:17:56.460: E/AACPlayer(8213):  at java.lang.Thread.run(Thread.java:838)

It just doesn't start playing, here is my code:

mMediaPlayer = new AACPlayer(this);
mMediaPlayer.setResponseCodeCheckEnabled(false);
mMediaPlayer.setMetadataEnabled(true);
mMediaPlayer.playAsync(C.link_streaming_radio);

try {
    java.net.URL.setURLStreamHandlerFactory( new java.net.URLStreamHandlerFactory(){
        public java.net.URLStreamHandler createURLStreamHandler( String protocol ) {
            Log.d( "LOG", "Asking for stream handler for protocol: '" + protocol + "'" );
            if ("icy".equals( protocol )) return new com.spoledge.aacdecoder.IcyURLStreamHandler();
            return null;
        }
    });
}
catch (Throwable t) {
    Log.w( "LOG", "Cannot set the ICY URLStreamHandler - maybe already set ? - " + t );
}

I really don’t understand why it works with some devices and some not. Thanks in advance.

+4
source share

Source: https://habr.com/ru/post/1534224/


All Articles