Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

All,

I'm creating a custom theme for WP and it has some pages that play videos from WP media library with an HTML5 player. I wanted to also have a link next to the player to allow the users to download the videos.

But a direct link to an mp4 file opens a native player in some browsers (like Chrome and Safari) and plays the video instead of opening it. So I'd have to put a note next to the link "Right click and choose save link as..." to let the users know how to save it, and I'd like to avoid that if possible.

So my question is, is there a way to maybe change the mime-type of the video (but only when accessed through the download link) to "application/octet-stream", or some other way, to make the browser save the file by default, instead of downloading it?

share|improve this question
add comment

1 Answer

use this in your .htaccess file:

ForceType applicaton/octet-stream

and it will force mp4 download from links


edit: force will force download if it's a link, but if you include the mp4 file in an object like an html5 video element, it will be played.

share|improve this answer
    
I already have AddType video/mp4 mp4 m4v in my .htaccess to make those files play on html5 browsers. Is ForceType compatible with it? I want to be able to play with the player and save with the link at the same time :) –  Matt Jan 24 '12 at 23:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.