html - cant play the video with the cgi script -


i don't know how ask this. trying play video file cgi-script.

here code(it working):

#!/usr/bin/perl use warnings; use strict; use cgi;  $cgi = cgi->new;  print $cgi->header(         -type=> "text/html" );  print <<eof; <video width="320" height="240" controls> <source src='http://127.0.0.1/video.mp4' type='video/mp4'> browser not support video tag. </video>  eof 

in <source> giving path of video.

#!/usr/bin/perl use warnings; use strict; use cgi;  $cgi = cgi->new;  print $cgi->header(         -type=> "text/html" );  print <<eof; <video width="320" height="240" controls>    <source src="home/praveen/ubuntu_workspace/c/video.mp4" type="video/mp4"> browser not support video tag. </video>  eof 

in code <source> path local directory. here stuck when give path (like /home/praveen/ubuntu_workspace/c/video.mp4) local drive cannot able locate path.

here error.log file writing:

[fri jan 29 13:06:43 2016] [error] [client 127.0.0.1] file not exist: /usr/lib/cgi-bin/home, referer: http://127.0.0.1/test.cgi 

after googling came know in web server not serve html in context of file:/// tree.

please tell me should access local files also.(like /home/praveen/../test.mp4. why giving error that.

please suggest me on going wrong.

the "src" attribute on <source> element requires url, not filesystem path. if source give is:

home/praveen/ubuntu_workspace/c/video.mp4

this relative url , (assuming no web server rewrite rules) server assume "home" refers directory called "home" subdirectory of directory html file is. , doesn't exist, "file not exist" error.

if source give is:

/home/praveen/ubuntu_workspace/c/video.mp4

this absolute url , (again, assuming no web server rewrite rules) server "home" directory in root of web space on server. that's /var/www/ or that. again, directory doesn't exist , you'll same error.

your web server has access files within web space.that's security feature. don't want go changing that.

the solution move video files directory inside web space host.

update: 1 other option configure web server support per-user web directories , put video files in there.


Comments