#!/usr/bin/perl use strict; use warnings; use File::Basename; my $file ='/home/abhishek/Videos/lua.mp4'; my $size = -s "$file"; my $begin=0; my $end=$size; (my $name, my $dir, my $ext) = fileparse($file, qr/\.[^.]*/); open (my $fh, '<', $file)or die "can't open $file: $!"; binmode $fh; print "Content-Type: application/x-vlc-plugin \n"; print "Cache-Control: public, must-revalidate, max-age=0"; print "Pragma: no-cache" ; print "Accept-Ranges: bytes"; print "Content-Length: $end - $begin\n\n"; print "Content-Range: bytes $begin'-'$end'/'$size"; print "Content-Disposition: inline; filename=\"$name$ext\"\n"; print "Content-Transfer-Encoding: binary"; print "Connection: close"; my $cur=$begin; seek($fh,$begin,0); while(!eof($fh) && $cur < $end) { my $buf=1024*16; read $fh, $buf, $end-$cur; $cur+=1024*16; } close $fh;