Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a problem with playing online mp3s. I'm using latest version of javazoom's jlayer and basicplayer. Here is the exception:

Caused by: javazoom.jlgui.basicplayer.BasicPlayerException:
    at javazoom.jlgui.basicplayer.BasicPlayer.initAudioInputStream(Unknown Source)
    at Source)
    ... 12 more
Caused by:
    at javax.sound.sampled.AudioSystem.getAudioFileFormat(
    at javazoom.jlgui.basicplayer.BasicPlayer.initAudioInputStream(Unknown Source)
    ... 15 more

My java is 1.6.0_16.

Certain files cannot be player through the Internet. I have a set of mp3s, playing one after the other. Randomly one mp3 doesn't work throwing above exception. Some mp3s can be played by calling again play() method if javazoom's basicplayer, but others can never be played online.

I was able to find this post but I doubt if this really relates to my directx version or something.


share|improve this question

migrated from Oct 26 '09 at 21:20

This question came from our site for professional and enthusiast programmers.

If you are streaming over HTTP, the web server seem to be closing the connection immediately without delivering any data. Some servers delivering MP3 over HTTP evaluate the request headers in an attempt to prevent tools from grabbing the media stream and will e.g. only deliver content if the request headers match a known media player. If you have a network sniffing tool and know a media player, which is working with the server you are trying to get content from, you can of course set the HTTP request headers in your Java program, so that the server thinks that you are using the regular media player.

share|improve this answer
The server is apache2, but request header cannot be the source of the problem, since a certain mp3 randomly works and doesn't work. – Mohsen Oct 26 '09 at 20:52

Can you download the file at that URL?

EOF is "end of file". It's losing the stream, or there's just no file there to get.

share|improve this answer
Yes I can, and the player works well when playing offline the same file. – Mohsen Oct 26 '09 at 20:54

I have had similar issues when the input or output streams are not managed properly... are you wrapping everything in try/catch/finally and closing all of the streams properly?

Some might work if you luck out and the buffer gets all of the content.

You might also try flushing (.flush()) the input stream.

Hope this helps.

share|improve this answer
-1: This isn't a program he made himself. – Wuffers Feb 11 '11 at 21:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .