I’m using JW Media Player to stream mp3 files.
Their forums suggest my use of the following script to avoid mp3 file caching …
[code=php]header(‘content-type: audio/mpeg’);
header(‘cache-control: no-store, must-revalidate’);
header(‘expires: sun, 06 oct 1974 21:00:00 gmt’);
$file_source = $_GET[‘source’];
$file_bandwidth = $_GET[‘bandwidth’];
$file_location = ‘audio/’.$file_source.’_’.$file_bandwidth.’.mp3′;
header(‘content-length: ‘.filesize($file_location));
$file_pointer = fopen($file_location, ‘rb’);
while (!feof($file_pointer)) {
echo(fread($file_pointer, 16384));
}
fclose($file_pointer);
I then use the following variable in my .swf embedding code …
[CODE]s2.addVariable(‘file’, encodeURIComponent(‘index.php?display=audio&source=’ + track + ‘&bandwidth=’ + bandwidth));
s2.addVariable(‘type’, ‘mp3’);
All of this is working but I have two questions / concerns.
1) I can access the audio file directly by typing “
2) Sometimes, my overall javascript/php approach is causing audio to load much more slowly than before. I don’t know much about the commands being used in these scripts, so I’m wondering if there’s a way to keep things streaming at a normal pace. Ideas? Observations? Could it be that my use of “encodeURIComponent” in the javascript or the port which is referenced by the php code?
Thanks in advance.