I have a list of unknown url's to shoutcast servers. I've come across a few servers that appear to stream AAC audio format, which I cannot support. The problem is when this type of server is encountered, my program basically locks up. Eventually, it'll throw an error then resume as normal.
Here's the code:
It has no problem getting the input stream. The hang up occurs when I try to get the audio file format. The error I'll then get (eventually) is:
URL streamUrl = new URL("http://22.214.171.124:7102");
InputStream is = streamUrl.openStream();
AudioFileFormat aff = AudioSystem.getAudioFileFormat(is);
I have no idea what that error means. I only seem to get it on servers that stream a content type that I do not have support for. In which case, I would've thought it'd just throw an UnsupportedAudioFileException.
java.io.IOException: Resetting to invalid mark
I'm not sure how to remedy this problem. It's not the error that I can't handle, its how long it takes to throw it. I mean it's taking several minutes at a time. I know I could use a thread to prevent the rest of my program from becoming frozen, but its not really an issue if I can't see the audio file properties for another 10 minutes anyway.