issues with readfile() and header()

atashi_sama

New Member
I have an mp3 handler that I use to serve mp3s for multiple reasons. I realized there is a problem in IE, Safari, and Google Chrome when the handler is used in a remote environment. The problem is, the mp3 file plays, and then restarts after about 20 seconds. This does not happen in Opera or Firefox. There is no problems streaming the file directly so it must be the handler, however for some reason streaming did work in a local environment in all browsers. Anyway, here is my code, I think the problem is with the header() or readfile(), but if the headers are removed, the issue still occurs. Any insight into this is greatly appreciated.PHP\[code\]$path="folder/$file_id/$mp3_name";header('Content-type: audio/mpeg');header('Content-Length: '.filesize($path)); // provide file sizeheader("Expires: -1");header("Cache-Control: no-store, no-cache, must-revalidate");header("Cache-Control: post-check=0, pre-check=0", false);readfile($path);\[/code\]Player\[code\]<object width="165" height="37" id="niftyPlayer1" align=""><param name="wmode" value="http://stackoverflow.com/questions/3603261/transparent"><param name=movie value="http://stackoverflow.com/questions/3603261/nifty/niftyplayer.swf?file=handler.php%3FID%3DDelete 930209d6459ad1e5436ba84040cd577e&as=1"><param name=quality value=http://stackoverflow.com/questions/3603261/high><param name=bgcolor value=#FFFFFF><embed src="nifty/niftyplayer.swf?file=handler.php%3FID%3D930209d6459ad1e5436ba84040cd577e&as=1";quality=high bgcolor=#FFFFFF width="165" height="37" name="niftyPlayer1" align="" type="application/x-shockwave-flash" swLiveConnect="true" wmode="transparent"></embed></object>\[/code\]
 
Back
Top