Hey all,
So I have this weird bug whenever I try to shuffle an mp3 playlist. The shuffling works find, the code was from another user's post:
function shufflePlaylist()
{
playlist = player.getPlaylist();
var newplaylist = playlist;
for(var rnd, tmp, i = newplaylist.length; i; rnd = parseInt(Math.random()*i), tmp = newplaylist[--i], newplaylist[i] = newplaylist[rnd], newplaylist[rnd] = tmp);
player.sendEvent('LOAD', newplaylist);
};
Somehow, whenever I click the 'Shuffle' button, it shuffles fine, but whatever song was initially playing (because I have autostart set to true) now displays a duration in the playlist! And everytime I click 'Shuffle' while another song is playing that song now shows its duration in the newly-shuffled playlist. I looked at the generated XML playlist, and it doesn't have the duration anywhere written in it, and the code looks pretty safe, so I'm really at a lost. This isn't a big bug, but I'm just confused by it. Does anybody have any ideas?
Thanks!

Maybe you should stop the player before you shuffle the playlist.
function shufflePlaylist(){
<strong>player.sendEvent('STOP');</strong>
playlist = player.getPlaylist();
var newplaylist = playlist;
for(var rnd, tmp, i = newplaylist.length; i; rnd = parseInt(Math.random()*i), tmp = newplaylist[--i], newplaylist[i] = newplaylist[rnd], newplaylist[rnd] = tmp);
player.sendEvent('LOAD', newplaylist);
};
*** EDIT ***
After a lot of testing, I can't reproduce this behavior.
When I shuffle while a track is playing, the duration always changes to the correct duration — JWMP-4.5.227.