[PHP] streaming media via php

2001-12-13 Thread Stephen VanDyke

Hello PHP people :)

I have a tough one here, I wrote a content script that plays media files,
but I can't seem to get things to actually buffer and stream as they should.
Here's the conundrum:

http://server/media/file.asf - Media player will buffer and start playing
before download completes
http://server/content.php?f=media/file.asf - Media player has to download
entire file before it starts trying to play

Here's the source of content.php, anyone see anything obvious that I'm
missing? I've been all over the HTTP/1.1 spec and media RFCs trying to
figure out what the heck I'm missing. Windows Media Player interprets the
media name as content if that's any help. Alse, the mime types are all
correct so that's not the issue, I'm just trying to figure out how to make
the players buffer+play instead of download+play.

?php
$mime_type = strtolower(strrchr($f,'.'));
$mime_type_array = array(
'.asf'  = 'application/vnd.ms-asf',
'.avi'  = 'video/x-msvideo',
'.gif'  = 'image/gif',
'.jpg'  = 'image/jpeg',
'.mov'  = 'video/quicktime',
'.mpe'  = 'video/mpeg',
'.mpeg' = 'video/mpeg',
'.mpg'  = 'video/mpeg',
'.ra'   = 'audio/x-pn-realaudio',
'.ram'  = 'audio/x-pn-realaudio',
'.rm'   = 'audio/x-pn-realaudio',
'.wmv'  = 'audio/x-ms-wmv'
);

// this is our security, bleh
if(!in_array($mime_type,array_keys($mime_type_array)))
{
header(Location: /error.php);
}
$filename = '/path/to/'.$f;
$dlname = substr(strrchr($filename,'/'),1);
$offset = (isset($nocache)?0:(86400 * 3));
header(Accept-Ranges: bytes);
header(Expires: .gmdate(D, d M Y H:i:s \G\M\T, time() + $offset));
header(Cache-Control: max-age=.$offset);
header(Last-modified : .gmdate(D, d M Y H:i:s \G\M\T,
filemtime($filename)));
header(Content-Length: .filesize($filename));
header(Content-Disposition: filename=$dlname);
if($debugx==1)
{
phpinfo();
}
else
{
header(Content-Type: .$mime_type_array[$mime_type]);
@readfile($filename);
}
?

Thanks in advance for any help,
Please cc me on any replies since I am not on this mailing list.

Stephen VanDyke


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] phpAtlanta User Group

2001-02-26 Thread Stephen VanDyke [OPIDO]

Hello everyone,

I know this is a bit of an deviation from the normal type of email this list
gets, so I'll keep it short. If you are reading this, then you have probably
judged by the title that this has to do with a user group, in Atlanta. If
you live in Atlanta, GA (or close enough that you tell people you live here)
then you may want to come join us and help us form a user group. We are
relatively new but we are already getting things rolling as far as meetings,
newsletters and the such.

If this interests you, come on over to http://www.phpatlanta.org/ for more
info. If you don't live in/around Atlanta please forward this message to
someone who does, or just delete it.

Thanks for your time.
Stephen VanDyke
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]