PDA

View Full Version : Streaming vs. downloading - code question


Chase32
08-31-2006, 10:05 AM
Hi,

I'm trying to provide an option to download and stream (or rather 'play while progressive downloading') some mp3 files. I used the following to lines of HTML to accomplish that:


<a href="/downloads-06/2006-08-06.m3u" type="audio/x-mpegurl">Play</td>

<td width="95"><a href="../downloads-06/2006-08-06.mp3">Download</a>


The first one launches Windows Media Player on my computer and plays the file using the M3U redirector. The second line does the same thing (on my computer, anyway). I was under the impression that I would get a download dialog box by using the second line. If they both use WMP to start playing it, why use a redirector at all? I guess I could just offer the right-click option on the filename, but wanted to make it simpler.

Does anyone know the proper way to do this?

Thanks!

hobbes
08-31-2006, 10:20 AM
The behavior will depend on the end user's browser and how it's configured to handle different file types. Right-clicking the mp3 is probably the best option, although you could develop a script that would force the Save As dialog to pop up by sending an HTTP header such as Content-Disposition: attachment; filename=file.mp3