views:

1486

answers:

3

I'm getting a pure binary MP3 stream from an ajax call. No headers, nothing. Just straight MP3 bits. (Actually is that really even a stream at all?)

I'd like to be able to play it in a web page (and, if possible, offer it for downloading).

Is this possible? And if so what's the best way to do it?

If it is not possible, what are some other ways to handle this?

+2  A: 

You cant play music with pure javascript. you will need to get that stream and pass it to a flash player.

try JW flash player, though i am not sure if it can handle the type of stream you are talking about. you will have to do some research about what it can handle

mkoryak
surely flash isn't the only option?
Chris Simpson
it's the most cross-browser compatible.
pixeline
+1  A: 

as indeed mentioned, you'll need a mp3 playing plugin, flash being the most widely available. The JMP3 jquery plugin makes that task easier for you. It does rely on a flash file for the sound processing.

pixeline
Ya, I'm trying that one now. But I don't see how to pass it the data. In a var?
thermans
+1  A: 

If you're only targeting very modern browsers, you could make use of data URL:s, and just write an object element to your HTML, and link to that data URL. Note: I havn't tried this.

Emil Stenström