Skip to content

Commit 0f984c7

Browse files
committed
Fixed state corruption on update context
1 parent ed46c33 commit 0f984c7

File tree

1 file changed

+3
-0
lines changed
  • core/src/main/java/xyz/gianlu/librespot/player

1 file changed

+3
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,8 @@ void update(@NotNull Remote3Frame frame) {
583583
if (frame.context == null)
584584
throw new IllegalArgumentException("Invalid frame received!");
585585

586+
TrackId oldPlaying = state.getTrackCount() > 0 ? TrackId.fromTrackRef(state.getTrack(state.getPlayingTrackIndex())) : null;
587+
586588
state.setContextUri(frame.context.uri);
587589
state.clearTrack();
588590

@@ -595,6 +597,7 @@ void update(@NotNull Remote3Frame frame) {
595597
}
596598

597599
if (pageIndex == -1) pageIndex = 0;
600+
if (trackUid == null && oldPlaying != null) trackUid = oldPlaying.toSpotifyUri();
598601

599602
int index = -1;
600603
List<Remote3Track> tracks = frame.context.pages.get(pageIndex).tracks;

0 commit comments

Comments
 (0)