Skip to content

Commit 93da102

Browse files
committed
Fix shuffle not persisting if before context creation (#330)
1 parent 100d248 commit 93da102

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

api/src/main/java/xyz/gianlu/librespot/api/handlers/PlayerHandler.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ private static void load(HttpServerExchange exchange, @NotNull Player player, @N
9090
return;
9191
}
9292

93-
player.setShuffle(shuffle);
94-
player.load(uri, play);
93+
player.load(uri, play, shuffle);
9594
}
9695

9796
private static void current(HttpServerExchange exchange, @NotNull Player player) {

player/src/main/java/xyz/gianlu/librespot/player/Player.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ public void setRepeat(boolean track, boolean context) {
206206
state.setRepeatingTrack(true);
207207
} else if (context) {
208208
state.setRepeatingContext(true);
209-
}else {
209+
} else {
210210
state.setRepeatingContext(false);
211211
state.setRepeatingTrack(false);
212212
}
@@ -239,11 +239,13 @@ public void seek(int pos) {
239239
handleSeek(pos);
240240
}
241241

242-
public void load(@NotNull String uri, boolean play) {
242+
public void load(@NotNull String uri, boolean play, boolean shuffle) {
243243
try {
244244
String sessionId = state.loadContext(uri);
245245
events.contextChanged();
246246

247+
state.setShufflingContext(shuffle);
248+
247249
loadSession(sessionId, play, true);
248250
} catch (IOException | MercuryClient.MercuryException ex) {
249251
LOGGER.fatal("Failed loading context!", ex);

0 commit comments

Comments
 (0)