Can't change song in jPlayer after media setting
I have a jQuery job that launches a jPlayer playing MP3 like below.
$("#jquery_jplayer_1").jPlayer({
ready: function () {
$(this).jPlayer("setMedia", {
mp3: mp3_url
});
$(this).jPlayer("play", 0);
},
swfPath: "/js",
supplied: "mp3",
});
This works great. But when I try to change the song to another mp3, I can't. I am running the same function but with a different one to mp3_url
no avail. I know the function is being called and that the arguments are being passed correctly. He gets inside a function (tested with alert();
) but doesn't know why it won't change the song?
Any help would be much appreciated.
thank
+3
source to share
2 answers
I solved the problem. Thanks for the help anyway.
Here is the code
function updatePlayer(name, artist, guid){
var player = $("#jquery_jplayer_1");
player.jPlayer({
ready: function () {
$(this).jPlayer("setMedia", {
mp3: guid
});
$(this).jPlayer("play", 0);
},
swfPath: "/js",
supplied: "mp3",
});
player.jPlayer("setMedia", {
mp3: guid
});
player.jPlayer("play", 0);
}
+2
source to share