Search code examples
javaandroidmedia-playerasfasx

How to play radio live stream .asx video/x-ms-asf?


Is there any 3rd-party library in Android or Java that can play radio live stream?

File extension: .asx
MIME type: video/x-ms-asf

Unfortunately, MediaPlayer does not support this format!

Here is the url of the live stream: http:// 38.96.148.75 /SunnahAudio


EDIT:

I was able to convert .asf file to .mp3 file by using JAVE:

File source = new File("sound.asf");
File target = new File("target.mp3");
AudioAttributes audio = new AudioAttributes();
audio.setCodec("libmp3lame");
audio.setBitRate(new Integer(64000));
audio.setChannels(new Integer(1));
audio.setSamplingRate(new Integer(22050));
EncodingAttributes attrs = new EncodingAttributes();
attrs.setFormat("mp3");
attrs.setAudioAttributes(audio);
Encoder encoder = new Encoder();
encoder.encode(source, target, attrs);

However, I'm streaming the .asf online and I am not sure if I could stream the radio station, convert it to .mp3, and immediately play it!


EDIT2:

I offer 500+ rep for anyone provides a full and working solution to play .asf live stream on Android. Basically, I want to play this radio station on Android (as xiialive can do):

http://38.96.148.75/SunnahAudio

Solution

  • If you open url of the stream in VLC player you can find out that it is an MMS stream using WMA codec mmsh://38.96.148.75/SunnahAudio?MSWMExt=.asf Here is an open source project aacplayer-android which uses libmms and libffmpeg to get WMA content from mms:// stream and play it.
    I hope it solves your problem.