Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: How to configure apache to play video files from local drive |
|
Author |
|
gizmo
Joined: 03 Sep 2024 Posts: 1
|
Posted: Tue 03 Sep '24 11:10 Post subject: How to configure apache to play video files from local drive |
|
|
I'm running Windows 10 PC and have been using html files run from local drive. I have been using <a href="file:/// links to various videos stored on local hard drive without any problems. When a link is selected the video will open and play in the video player (ZoomPlayer) I have installed. Only problem was any additions or deleted videos required rewriting the html code. I recently installed WAMP v3.3.5 usng php, MySql & Apache 2.4.59 to help make the code more automated and easier to manage. I store the video description and all the file information in a MySql database and use php to retrieve info needed to create the code for links to the video files. All working almost as intended. My problem I've run into is the file link would do nothing.
I have setup alias for the drive outside of the webroot folder in the Apache httpd.conf file.
Alias /disk1 "F:"
<Directory "F">
Options Indexes FollowSymLinks MultiViews
Require all granted
</Directory>
AddType video/x-msvideo .avi
AddType video/mp4 .mp4
AddType video/x-matroska .mkv
Using Firefox when a link is selected, the video downloads first to the windows temp folder then starts playing normally in Zoomplayer.
Using Chrome, the video players in browser video player and not Zoomplayer as intended.
Just to state that this is running only on a local LAN and only used for personal use. No ports have been opened on internet facing router.
This is intended for local use only and not to be accessed from the web.
How can I avoid the download step and have it simply open in my windows video player?
Last edited by gizmo on Tue 03 Sep '24 22:59; edited 1 time in total |
|
Back to top |
|
tangent Moderator
Joined: 16 Aug 2020 Posts: 348 Location: UK
|
Posted: Tue 03 Sep '24 21:28 Post subject: |
|
|
You need to explicitly tell the client browser what to do with the video content; whether to play it internally, or save it as an attachment (download). You can do this in Apache by setting the "Content-Disposition" header to either "inline" or "attachment", e.g.
Code: | <FilesMatch "\.avi|\.mkv|\.mp4$">
# Header add "Content-Disposition" "inline"
Header add "Content-Disposition" "attachment"
</FilesMatch>
|
If you choose to download the file, then your Windows client can be set to open that file type with a preferred application; Zoom Player in your case. You'll need to manage downloaded files manually. |
|
Back to top |
|
|
|
|
|
|