File tree Expand file tree Collapse file tree
core/src/main/java/xyz/gianlu/librespot/player Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414
1515import java .io .Closeable ;
1616import 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 ();
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments