Re: Adding Download Button in the player

928 views
Skip to first unread message

Dan.S

unread,
Jul 21, 2012, 2:15:00 PM7/21/12
to jpl...@googlegroups.com
Any idea?

Mark Panaghiston

unread,
Jul 23, 2012, 9:52:29 AM7/23/12
to jpl...@googlegroups.com
Look around line 217 in jplayer.playlist.js. There is the _createList Item() method. This is where you can change the HTML that the JS creates for the playlist.

The other thing, downloading the mp3 with a left click, is a pain due to the browsers trying to be real handy and play the mp3 for you. This is because of the mime type. If the mime type is correct, which is should be, the mp3 will play in browser, if fudged as the ZIP mime type, then it gives the download prompt of the browser.

Maybe in the past I suggested using the PHP smartReadFile() function. But I think that is a bit much to just get the mime type right. Plus that focuses more on serving the file correctly.

The way to do it is probably best through server options. On Apache, the .htaccess file can be used to change the MIME type and to rewrite urls... You need a difference in the 2 urls for the same mp3 file. They both serve the same file, but 1 of them has the wrong mime type.




On Saturday, 21 July 2012 04:05:02 UTC+1, Dan.S wrote:
Hello,
I know a few people asked this question before, but I could not solve my problem yet.  So I decided to ask this question again.  I have a mp3 music list that all of them should have download button.  I added the free:true in the play list but as you know it only works when the user does right click otherwise it only plays them music.

I know I need a php file to do that, but do not know what should I have in the php file and how to link it to that 'mp3' button which appears in the player.  Furthermore I am interested to know how can I change that 'mp3' button to a real button and something look like a button.  I know CSS, just need to know where to edit it.

I uploaded my player on my host so you can see the work.
http://mersadesign.com/demo/player/demo-02-media-solution-flash-html-pf.htm

Thanks in advance.

Dan.S

unread,
Jul 23, 2012, 1:58:16 PM7/23/12
to jpl...@googlegroups.com
Thank you for your respond.
For that mp3 word in the playlist, I could not find line 217 because my code is all in 31 lines. (Have a look at the attached file)
However I could find the +a+ value.  So created a new value, like:
DL='Download';

and in the html bit I replaced +a+ by +DL+ and now it shows download instead of mp3 in the play list.  Thanks for your help.

But for the second part of your answer I should say did not really understand it.
Do you suggest to wright a new command in the .htaccess ?  If so, what command is it?
What if to use that smart php file?

I do not know which way is better, but for any of them that you prefer, please give me a detailed instruction to make it working.

Many thanks.
playlist.png

Dan.S

unread,
Jul 23, 2012, 4:11:49 PM7/23/12
to jpl...@googlegroups.com
Ok people,
As this question is already asked, I tried to copy what other people did, and implemented in my codes.

The download button is there now, and working.  Although I wanted to have this button in front of each music, but anyway.

I attached the final work, cuz I know many people would have this functionality and might spend many days like me to fix it.  So it's ready there now.
player with DL.zip

Equipo ENVIVO

unread,
Jul 23, 2012, 5:01:21 PM7/23/12
to jpl...@googlegroups.com
Thanks Dani, this is a great comunity. I know people are going to use your implementation. 

Gabriel García



2012/7/23 Dan.S <danial_...@hotmail.co.uk>

--
You received this message because you are subscribed to the Google Groups "jPlayer: HTML5 Audio & Video for jQuery" group.
To view this discussion on the web visit https://groups.google.com/d/msg/jplayer/-/zIoEOA3TVh8J.
To post to this group, send email to jpl...@googlegroups.com.
To unsubscribe from this group, send email to jplayer+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jplayer?hl=en.

Anthony Darden

unread,
Jul 24, 2012, 1:39:32 PM7/24/12
to jpl...@googlegroups.com, env...@iduai.org
Definitely!  Thanks Dan! 
Gabriel García



2012/7/23 Dan.S <danial_...@hotmail.co.uk>
To unsubscribe from this group, send email to jplayer+unsubscribe@googlegroups.com.

Mark Panaghiston

unread,
Jul 25, 2012, 9:32:29 AM7/25/12
to jpl...@googlegroups.com, env...@iduai.org
The source code for jPlayerPlaylist is on the download page:
http://jplayer.org/download/

Or the development source is on GitHub:
https://github.com/happyworm/jplayer/


Christopher Nchabeleng

unread,
Oct 7, 2016, 6:06:31 AM10/7/16
to jPlayer: HTML5 Audio & Video for jQuery
Hi Dan,

Thanks for such a great implementation.
I have challenged when downloading using my mobile.

The error says the downloadengine.php file cannot be accessed, i tried
to change the persmissions but the error still persists.

How can i resolve this?

Thanks.
Reply all
Reply to author
Forward
0 new messages