Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

amending right click menu to download audio from jPlayer 1

Status
Not open for further replies.

nickharambee

Technical User
Jan 2, 2010
7
GB
I am using a javascript audio player on a webpage that has an option to download the track by right clicking on a link called 'mp3' at the end of each track in the playlist. When the user right clicks on the track name however all that can be downloaded is an html file.

I am trying to find a way of changing this so that right clicking on the track and choosing the 'save link as' option will download the mp3. I have been led to believe that I can use a script such as this one:


to generate a custom content menu for downloading tracks, or somehow downloading the mp3, but I am at a loss at to how to do this.

Here's a screenshot of a track in the playlist:

m.png


And here is the source:

Code:
{name:"foster manganyi na tintsumi ta tilo - zion (ndzi teke riendzo no. 1) <span style=\"color:#BDBDA1; font-size:12px;\">[from nick]</span>",mp3:"./songs//nick/zion.mp3"}

I would be grateful for any advice on getting this working,

Thanks,

Nick
 
Hi

Instead of the believed solution and screenshot of the page show us the page itself. We can not debug your existing problem from a so far unused jQuery plugin and an image.

By the way, I hate right click hijacking attempts. Fortunately my FireFox is immune to them.


Feherke.
 
Hi

And where is the piece from your screenshot, the one tagged "from nick" ?

Anyway, I can not found the bug you described. In Gecko and WebKit works perfectly, in KHTML no playing but the playlist is displayed and download works, in Presto not works at all.


Feherke.
 
The screenshots I took were from a webpage I haven't properly published yet, so I sent a link to the same type of playlist, with the same mp3 links.

It wasn't a bug I was reporting, just a feature I'd like to add to the playlist, i.e. the ability to right click on the track name and download the mp3. I am presuming that you right clicked on 'mp3' which I know works. I am hoping to be able to drop the mp3 link and just use the trackname for downloads.
 
Hi

Ah, got you now.

Theoretically if you change the displayPlayList() function's 4[sup]th[/sup] line should be Ok :
Code:
[gray]// old[/gray]
listItem [teal]+=[/teal] [green][i]"<a href='#' id='jplayer_playlist_item_"[/i][/green][teal]+[/teal]i[teal]+[/teal][green][i]"' tabindex='1'>"[/i][/green][teal]+[/teal] myPlayList[teal][[/teal]i[teal]].[/teal]name [teal]+[/teal][green][i]"</a> (<a id='jplayer_playlist_get_mp3_"[/i][/green][teal]+[/teal]i[teal]+[/teal][green][i]"' href='"[/i][/green] [teal]+[/teal] myPlayList[teal][[/teal]i[teal]].[/teal]mp3 [teal]+[/teal] [green][i]"' tabindex='1'>mp3</a>)</li>"[/i][/green][teal];[/teal]

[gray]// new[/gray]
listItem [teal]+=[/teal] [green][i]"<a href='"[/i][/green] [teal]+[/teal] myPlayList[teal][[/teal]i[teal]].[/teal]mp3 [teal]+[/teal] [green][i]"' id='jplayer_playlist_item_"[/i][/green][teal]+[/teal]i[teal]+[/teal][green][i]"' tabindex='1'>"[/i][/green][teal]+[/teal] myPlayList[teal][[/teal]i[teal]].[/teal]name [teal]+[/teal][green][i]"</a>"[/i][/green]
I only tested it partially, but hopefully will work.


Feherke.
 
I agree with feherke. You get no mp3 because the actual link of the player entries are just hashes "#". If you add the path to actual file from the .mp3 property of your object instead of the hash you should be able to get the file downloaded provided of course there is no security in place for the mp3 folders that would prevent the download.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Thanks very much feherke.

Changing the script in the way you mention works just as i'd like it to. I tested in Safari, Opera, Firefox, Chrome & IE8.

Enjoy the day or night, or whatever it might be....

Nick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top