I have been trying to find/write some code to stream a single MP3 file when a user clicks on the play icon of the audio file they want to hear. The icon does not (and must not) provide a direct link to the .mp3 file or a .m3u file.
I have tried a number of scripts, the closest I have come to success is the following:
Code: Select all
header("Content-Disposition: inline; filename=play.m3u");
header("Content-type: audio/mpegurl");
header("Cache-control: private");
readfile($content);play.m3u doesn't exist.
This causes Winamp to fire up but it gets two entries in its playlist... the first ends up causing some sync error and the 2nd is the file which finally starts streaming.
So it sort of works, but is a bit messy. As to whether I need all those 'header' lines or not, I don't know. Do I need to make a .m3u file?.. again, I'm not sure.
If someone could help me out with this it would be greatly appreciated. Thanks.