![]() |
Can you configure Apache to do this?
Make Apache play .mp4 files as usual but
make Apache download .MP4 files to the users computer. Is this possible? If so, how? Thanks for your help :thumbsup |
The only way I can think of is setting a different mime type for MP4 files.
|
Quote:
What I'm trying to do is have a solution where I have one copy of each video file. Where .mp4 plays in my video player for member and when they click the download link, it will link to a .MP4 copy that downloads automatically. |
bump :helpme :thumbsup
|
you could use htaccess like this in the folder with the videos
Code:
RewriteEngine on Code:
<?php |
Quote:
This is great THANK YOU! Before reading your post I came across a recomendation to add this to my .htaccess AddType application/octet-stream .mp4 <FilesMatch "\.(docx?|txt|mp4?)$"> Header add Content-Disposition "attachment" </FilesMatch> So far what this does is allows my jwplayer to play .mp4 files, but when a link with an .mp4 file is clicked, the user is prompted to download the file. So I don't need two copies of the video file. Do you see any drawback to this? I'm not big on programming and have no idea if this doesn't work for everyone. |
dont you want to be able to embed mp4?
|
Quote:
but really you just need the htaccess you posted because the player will stream it either way |
Quote:
This works for me on Chrome and Internet Explorer. Click here to see an example. Does this embed and download the same file for you guys too? If not, what browser and OS are you using? I really appreciate the help :thumbsup . |
Works for me in Opera.... but you might have issues with cellphones (androids) playing the video as I think they need to see the proper mime type. That's one of the reasons trying to "fake it" in apache etc isn't done and ppl have to right click to download or run the download thru a separate script.
|
Quote:
Instead set the headers in the .htaccess. |
Quote:
Instead set the headers in the .htaccess. Smokey did manage to halfway avoid one bug, so his implementation has only 2 1/2 major issues. That's definitely better than most people do. Still remaining is the big which for about a year caused one popular CMS to crash servers fairly regularly and this code too will crash your server when it gets busy. It also has a glaring security hole. |
Quote:
Quote:
However on my IPad no video shows, only the "download" graphic appears, and when clicked on, it plays the video. On my Android phone no video shows, only the "download" graphic appears, and when click on, it downloads the video to the phone without viewing. So maybe if I adjust the longtail player setting to be html5 compatible it could fix this problem? Thanks for your input I really appreciate it :thumbsup |
Quote:
|
By the way, what any of this does is SUGGEST to the browser that a file could be saved in the one case or played in the other case. There is absolutely no forcing going on. You can't MAKE them save the file to the hard drive. As far as you know, they may be on a diskless system that doesn't even HAVE a hard drive. You're merely suggesting an appropriate way the file could be handled.
|
Quote:
|
Quote:
|
Quote:
|
All times are GMT -7. The time now is 07:07 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123