我正在使用此库开发应用程序以播放无线电服务:
https://code.google.com/p/aacdecoder-android/
该服务是一个有效的Shoutcast流媒体,它指向一个.pls文件。 它适用于我的Nexus 4和我试过的一些三星设备,但我在阿尔卡特手机上遇到以下错误:
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)
它只是没有开始播放,这是我的代码:
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 );
}
我真的不明白为什么它适用于某些设备,有些则不然。 提前谢谢。