WWW::Video::Streamer - A HTTP video streamer and browser.
Version 0.0.1
use WWW::Video::Streamer; my $wvs = WWW::Video::Streamer->new(); #read the config if it exists if (-e './config.ini') { $wvs->config('./config.ini'); } #invoke the CGI stiff $wvs->cgi;
Initiates the object.
my $wvs=WWW::Video::Streamer->new;
This handles a handles the CGI interface.
$wvs->cgi;
This reads the config.
if (-e './config.ini') { $wvs->config('./config.ini'); if($wvs->{error}){ print "Error!\n"; } }
This handles displaying directories.
Takes the template and generates a proper string to run mencoder.
my $mencoderstring=$wvs->mencoder($file); if(!$wvc->{error}){ print "Error!\n"; }
This checks if the file is playable or not.
Currently this just checks if the mimetype matches /^video\//.
This will error if no file is specified.
$playable=$wvc->playable($file); if($wvc->{error}){ print "Error!\n"; }else{ if($playable){ print "Playable.\n"; }else{ print "Not playable.\n"; } }
This streams the specified file to standard out.
$wvc->stream($file); if(!$wvc->{error}){ print "Error!\n"; }
This blanks the error storage and is only meant for internal usage.
It does the following.
$self->{error}=undef; $self->{errorString}="";
Failed to read the config.
No file is defined.
File requested is not below the specified directory.
The file is below the specified directory, but is not a file or directory.
Opendir failed for the path.
Path does not exist.
Path is not defined.
Path is not a directory.
Failed to build mencoder string.
The requested file does not exist.
The video directory does not exist.
The below is a example config file at the defaults.
x=100 y=100 vb=120 ab=40 dir=/arc/video/ mt=/usr/local/bin/mencoder {$file} -oac mp3lame -ovc lavc -of avi -lavcopts vbitrate={$vb} -lameopts cbr={$ab} {$size} -vf scale={$x}:{$y} -really-quiet -o -
This is the default audio bit rate to use for the encoding.
This is the base directory for video.
This is the mencoder template that will be used.
This part of the template will be replaced with the audio bit rate.
This part of template will be replaced with the file name.
This part of the template will be replaced with the video bit rate.
This part of the template will be replaced with the video width.
This part of the template will be replaced with the video heigth.
This is the default video width
This is the default video hieght.
These are currently ignored by the dir function.
The file names passed to it are escaped when they are passed to mplayer.
Care should be taken to make sure that the config file is not writable by any untrusted users as changing the 'mt' variable can allow other things to be executed.
If none-numeric values for 'x', 'y', 'ab', or 'vb' are found when it goes to play it, the defaults are used.
Copy 'bin/wvs.cgi' to your directory on your web server, enable CGI on that directory, and then if you want to override the defaults create 'config.ini' in hat directory.
Zane C. Bowers, <vvelox at vvelox.net>
<vvelox at vvelox.net>
Please report any bugs or feature requests to bug-www-video-streamer at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Video-Streamer. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-www-video-streamer at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc WWW::Video::Streamer
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-Video-Streamer
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/WWW-Video-Streamer
CPAN Ratings
http://cpanratings.perl.org/d/WWW-Video-Streamer
Search CPAN
http://search.cpan.org/dist/WWW-Video-Streamer/
Copyright 2009 Zane C. Bowers, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install WWW::Video::Streamer, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Video::Streamer
CPAN shell
perl -MCPAN -e shell install WWW::Video::Streamer
For more information on module installation, please visit the detailed CPAN module installation guide.