LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   CentOS (https://www.linuxquestions.org/questions/centos-111/)
-   -   how to play videos on apache server (https://www.linuxquestions.org/questions/centos-111/how-to-play-videos-on-apache-server-4175594435/)

robertkwild 11-29-2016 09:34 AM

how to play videos on apache server
 
hi all,

i have made a LAMP server on a centos machine, i know you put any files you want to publish here -

/var/www/html/

but what about if you copy a video file to that location, how do you play it back on the browser?

many thanks,

rob

michaelk 11-29-2016 11:51 AM

You need to create a web page that "points" to the video. That can be done several ways and the video needs to be in a format that supports the method.

http://www.computerhope.com/issues/ch000591.htm
http://www.w3schools.com/TAgs/att_video_src.asp

273 11-29-2016 01:05 PM

On my local network I just point my Apache server to the files then they play, in VLC, when opened with my browser.
You may need to describe the situation more clearly?

robertkwild 11-30-2016 05:58 AM

i have it working by typing out the full path ie -

http://host-ip/directory-where-video-is/video-file.mp4

this plays as an embedded video on firefox and chrome but IE it asks me whether i want to open it or save it and when i choose open it opens up my default video player VLC

how can i play it embedded in IE

wpeckham 11-30-2016 06:43 AM

About your title: You cannot actually play videos in apache server: Web servers just send files and data to your browser. It is the browser that can actually play or render things or call 'helper' programs to do that.

A video is just a file. Make an HTML or XHTML properly formatted page that the browser can use to download your video and it will attempt then to render it. If it can, you are golden; if it cannot you may need to configure something (vlc?) to 'help' it with that final step or choose a different browser.

273 11-30-2016 01:29 PM

Perhaps you're referring to the ability of HTML5 to embed video? In which case you need suitably encoded files and an HTML5 page for each file with (I'm going from memory here) something like a video canvas or video object embedded.

wpeckham 12-01-2016 06:00 AM

Quote:

Originally Posted by 273 (Post 5636361)
Perhaps you're referring to the ability of HTML5 to embed video? In which case you need suitably encoded files and an HTML5 page for each file with (I'm going from memory here) something like a video canvas or video object embedded.

Actually, no, I was just referring to the older way of providing a file using a link and trust the browser to manage it on the client end. The HTML5 media extensions are nice, but not globally supported. Yet.
Frankly I had not thought of using the media extensions in HTML5, and that might be a good thing to try!

273 12-01-2016 01:25 PM

Quote:

Originally Posted by wpeckham (Post 5636618)
Actually, no, I was just referring to the older way of providing a file using a link and trust the browser to manage it on the client end. The HTML5 media extensions are nice, but not globally supported. Yet.
Frankly I had not thought of using the media extensions in HTML5, and that might be a good thing to try!

My apologies, my reply was to the OP rather than you but I am glad if it gave you some ideas to play with.
The behavior described by the OP seems to be IE specific so it's either a client problem for all clients using IE and the IE clients need a group policy applying or, if they're not under control of the page writer, they need nudging by something like HTML5 tags.

notKlaatu 12-01-2016 01:39 PM

As others have pointed out, Apache doesn't "play" video; it serves a file. If a browser isn't "smart" enough to play the file, then the user ought to use an application that is meant to play that file type (such as vlc, which can play local or remote video quite happily).

If you want to use HTML5 magic, then something like this ought to do:

Code:

<video class="motionpicture" width="720" height="480" autobuffer
controls preload="auto">

<source src="/path/to/vid.webm" />
Your browser does not appear to support HTML5 media. Try updating
your browser or (if you are not already) using an open source
browser like Firefox." </video>



All times are GMT -5. The time now is 02:58 AM.