Sound class - File headers, IOErrors, and 404s

Hi, all

I’m developing an mp3 player for a rather large music search engine. The files that are played are found on the web, so it’s increasingly difficult to gracefully determine to the validity of them.

This file for instance:

http://boxstr.com/files/2863558_hqzwk/lil%20wayne%20freestyle.mp3

This is a file that our spider picked up and cached at some point. Now when a user loads this track into the player today, it’s obviously a dead link and is actually a gif. What’s also troubling is that in this case, Flash doesn’t ever receive a 404 for the mp3 file. It actually tries to load the file.

The problem is that I’m getting really inconsistent results when dealing with bad links. Some sites will send back a 200 even though it should be a 404. The sound class in AS3 doesn’t seem adequate for dealing with with type of scenario. The IOErrorEvent.IO_ERROR only fires is it gets back a 404 or if the connection is dropped.

Does anyone have a solution to deal with broken links? Is there any way to check the file/mime type returned? Right now I have a jenky solution that checks the total bytes with a timer. This is definitely not ideal as it doesn’t account for users with slow connections. I’d love a seamless solution that will detect a bad link, report it as invalid, and immediately move on to the next track in a playlist.

Thanks very much.