note 49725 rejected from function.readfile by cece

From: Date: Mon, 07 Feb 2005 11:14:38 +0000
Subject: note 49725 rejected from function.readfile by cece
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-84612@lists.php.net to get a copy of this message
Note Submitter: ---- I wrote a small routine to let visitors listen to RealAudio clips of my band. I prefer this technique as it hides the location of the music files. I call the script like this : sapra.php?tune=tunename and the script looks like : <? $fname = "ra/$tune.rm"; if (!file_exists($fname)) die("No such file : $fname"); header("Content-type: audio/x-pn-realaudio"); header("Content-Length: " . filesize($fname)); readfile($fname); ?> The script works fine, however there is a huge delay before RealPlayer starts playing. I've tried a couple of variations with different headers (Cache-Control, Content-Disposition, etc.), but the delay stays. Then, I read Bob Funk's comments and replaced the readfile() with a fopen/fread/fclose loop. Alas, the delay persists. I even put a flush() after each write to output. Anyone have any comments how I can get the same performance (or close to it) as the classic .ram file method of playing RealAudio files? Thanks

« previous php.notes (#84612) next »