Best Script or Tool for offerring mp3's to play or download - slick user interface.
A question as old as time, I know I've spent years on it myself.
I'm tricking browsers right now by adding a content type of attachment to my mp3 headers. This as you know opens up the Windows dialog asking if you want to open or save this file. Opening of course plays it.
I'd like something slicker, something where I'm not relying on a browser trick, something where 'play' is one link and 'download' is another....
Any thoughts or recommendations are appreciated. I've searched and searched but only find client side suggestions for the best media players and such.
Look in to the HTML5 audio element. I like using MediaElement.js as it offers a good cross browser experience:
Thanks, I'll check it out.
But I was hoping for a script or some software that offers up the mp3 based on what is clicked - like download or play.
The mediaElement is another player.
I've heard that HTML5 solves this - you just add the word 'download' to the anchor tag of the download link, and leave it off of the other link - Has anyone tried this ?
I'm confused. You would simply have two options. One would be the "play" where you could use the Media Element JS script. The other would be download, where you can use the method that you already have.
The current 'download' method isn't perfect as it just adds header content type attachment to force the pop up window which offers 'Open' or 'Save' - this still allows playing (Open) and is a bit messy. A straight Download button and media player would be cleaner.
Originally Posted by cbVision
You could use PHP to 'force' a download of the mp3, and then just use the mediaelement.js beside whatever download link you offer.
There's actually a topic on this forum about getting PHP to force a download of an mp3: http://www.webdeveloper.com/forum/sh...d-of-streaming
Post #4 shares the PHP code for what you want to do. You may want to modify it slightly, depending on how you want to select the file. For instance, you may not want the filename in the link, so you could utilize some id system perhaps. Or maybe you could just include the filename itself but have the files in a folder (not displayed anywhere), and in the PHP file append the folder to whatever filename is passed (to protect the audio files directory, if you care about that).
Great, I'll give that a try.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread