How to add a download link to a movie from WP media library?

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.

Read More

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?

Related posts

Leave a Reply

1 comment

  1. 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.