3

I want to code an audio player in Java. java.JavaFX has a very nice support for mp3 playing but I want in my player also the possibility to listen to radio.

The problem is I have searched for some time and I didn't find something that works like I want:

  • MP3SPI - this is nice but just wont play some streams
  • vlcj - I've tested the latest version 1.2.0 but was with a beta version of VLC so I had times when the stream just stopped for no reason.
  • NativeSwing's windows media player but that is a heavyweight component and also I don't want to make it dependable on WMP.

So I'm kind of out of luck. Well guys If you know more about this topic please share it! Thank you!

2 Answers 2

1

MP3 playback in Java is a bitch. In nearly any case it's not worth the work you put in it.

However, this is something that worked for me. It can easily be recoded to play Shoutcast streams.

1
  • Hi and sorry for the delay (school).The problems I have with MP3SPI is:on windows it gives me "Invalid HttpResponse" and on Linux there are some streams that just wont play (89.47.247.59:8020/).The code looks exactly as on their website but I have replaced AudioInputStream in= AudioSystem.getAudioInputStream(file); with AudioInputStream in= AudioSystem.getAudioInputStream(new URL(89.47.247.59:8020)); Jun 29, 2011 at 8:12
1

JavaLayer (library behind MP3SPI) is a mature project and should handle most streams, can you post some streams that it can not read? Check that other players using JavaLayer, like jlGUI, can play these streams. Maybe it's something with your code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.