awanti has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to play the video from the <video> tag with the cgi script. Here is my code
#!/usr/bin/perl use warnings; use strict; use CGI; my $cgi = CGI->new; print $cgi->header( -type=> "text/html" ); print <<EOF; <video width="320" height="240" controls> <source src="/home/ubuntu_Workspace/c/video.mp4" type="video/mp4"> </video> EOF
When i keep the file in the server i can play it.But if i keep the video file in some other directory it wont play the video instead it will give the error. After doing some research i came to know that it should be in the path where server can access that directory.So the most cases it would be /var/www/ path.But what should i do when the video files are in the different paths.I mean it could be able to play the file whichever path it may be.

Replies are listed 'Best First'.
Re: (OT) HTML video tag is not working in cgi
by LanX (Saint) on Jan 28, 2016 at 12:30 UTC
    hippo is right

    /home/ubuntu_Workspace/c/video.mp4 is not an URL it's a path of your file system.

    This might work with HTML loaded from your disk, because the browser assumes the file:// protocol.

    But if you are routing thru a web-server you have to provide a real URL ( http://... )

    As you see this is not a Perl problem, please try to acquire some web-server basics.

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

[OT] Re: (OT) HTML video tag is not working in cgi
by hippo (Archbishop) on Jan 28, 2016 at 11:40 UTC

    This is an HTML question and is unrelated to Perl.

    Use a URL in the src attribute, even a relative one and you should be fine.

    Addendum: You might find Mapping URLs to Filesystem Locations to be informative.

      It is working if i write it in a plain html file...if i write in the cgi script..it is not working
        write it in a plain html file

        What are you putting in the html file ?