Webcam on websites? Ugh!!!
| From: | Webleycity | Date: | Sat, 15 Dec 2001 21:50:01 +0000 |
| Subject: | Webcam on websites? Ugh!!! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-77829@lists.php.net to get a copy of this message | ||
Hello All
A client wants a webcam on his site. Does any body know what script is used
and how it works.
Is there anyone out there with experience of this.
-------------------------------------------
Mark Webley
Multimedia design and development
WebleyCity Limited
London United Kingdom
mark@webleycity.com
mark.webley@psion.net
Mobile: 07980 213 627
Fax/Tel: 0208 678 1721
Pager 07654 581816
http://www.webleycity.co.uk
-------------------------------------------
> From: "Stephen VanDyke" <stephen.vandyke@natnet.com>
> Date: Thu, 13 Dec 2001 12:07:38 -0500
> To: <php-general@lists.php.net>
> Cc: "Stephen VanDyke [NN]" <stephen.vandyke@natnet.com>
> Subject: [PHP] streaming media via php
>
> 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: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>