Skip to content

Commit c1006ec

Browse files
committed
Ignoring play-token (breaks code)
1 parent 495c15b commit c1006ec

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import java.io.Closeable;
1616
import java.io.IOException;
17+
import java.util.Objects;
1718

1819
/**
1920
* @author Gianlu
@@ -94,7 +95,8 @@ public void frame(@NotNull Spirc.Frame frame) {
9495
handlePlay();
9596
break;
9697
case kMessageTypePause:
97-
handlePause();
98+
if (!Objects.equals(frame.getIdent(), "play-token"))
99+
handlePause();
98100
break;
99101
case kMessageTypePlayPause:
100102
handlePlayPause();

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public class PlayerRunner implements Runnable {
4242
private final int duration;
4343
private final Object pauseLock = new Object();
4444
private final AudioFormat audioFormat;
45+
private final boolean preloadEnabled;
4546
private Controller controller;
4647
private byte[] buffer;
4748
private int count;
@@ -69,6 +70,7 @@ public class PlayerRunner implements Runnable {
6970

7071
readHeader();
7172
this.audioFormat = initializeSound(conf);
73+
this.preloadEnabled = conf.preloadEnabled();
7274

7375
audioIn.mark(-1);
7476

@@ -248,7 +250,7 @@ private void decodeCurrentPacket(@NotNull SourceDataLine line) {
248250
}
249251

250252
private void checkPreload() {
251-
if (!calledPreload && !stopped && (duration / 1000) - time() <= TRACK_PRELOAD_THRESHOLD) {
253+
if (preloadEnabled && !calledPreload && !stopped && (duration / 1000) - time() <= TRACK_PRELOAD_THRESHOLD) {
252254
calledPreload = true;
253255
listener.preloadNextTrack();
254256
}

0 commit comments

Comments
 (0)