Search code examples
javascriptjqueryasp.netvisual-studio-2012jplayer

how to dynamically pass songs to jPlayer?


I am working on a metro-looking asp.net application right now. It's a mp3 player where you choose artist (clicking on a tile), then album (same) and you pick a song from the list.

Now I want to pass the picked song's filename and location to jPlayer so that it replaces the actual played song. I know how to play one song specified in the players constructor but have no idea how to change it dinamically.

I don't need to stick to jPlayer, if You can recommend me any other player that can do above in easier way there is no problem :)

(English is not my main tounge, sorry for mistakes, I hope it is understandable).


Solution

  • Have you tried this?

    $("#jquery_jplayer_1").jPlayer("setMedia", {mp3: url}).jPlayer("play");
    

    Pulled from: Changing songs on jPlayer by clicking a link, hosted on Amazon S3