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.
This commit is contained in:
François-Xavier Thomas
2016-11-27 18:56:32 +00:00
committed by Eugene E. Kashpureff Jr
parent 5c5bce6f8d
commit 739fafe633
@@ -133,6 +133,15 @@ public class StreamController implements Controller {
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.addFiles(true, file);
player.setPlayQueue(playQueue);