Fix shuffle behavior introduced in #132

The player's current file was not being updated, resulting in always
considering that it was playing the first one when shuffling.
master
François-Xavier Thomas 8 years ago committed by Eugene E. Kashpureff Jr
parent 5c5bce6f8d
commit 739fafe633
  1. 9
      libresonic-main/src/main/java/org/libresonic/player/controller/StreamController.java

@ -133,6 +133,15 @@ public class StreamController implements Controller {
return null; return null;
} }
// Update the index of the currently playing media file. At
// this point we haven't yet modified the play queue to support
// multiple streams, so the current play queue is the real one.
int currentIndex = player.getPlayQueue().getFiles().indexOf(file);
player.getPlayQueue().setIndex(currentIndex);
// Create a new, fake play queue that only contains the
// currently playing media file, in case multiple streams want
// to use the same player.
PlayQueue playQueue = new PlayQueue(); PlayQueue playQueue = new PlayQueue();
playQueue.addFiles(true, file); playQueue.addFiles(true, file);
player.setPlayQueue(playQueue); player.setPlayQueue(playQueue);

Loading…
Cancel
Save