Skip to content

Commit ffd4c58

Browse files
committed
Reset track position state on process termination
1 parent dd16cd9 commit ffd4c58

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/java/de/labystudio/spotifyapi/platform/windows/WinSpotifyAPI.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ protected void onTick() {
8484
}
8585

8686
if (playback.hasTrackPosition()) {
87+
this.hasTrackPosition = true;
88+
8789
int lastReportedPosition = playback.getPosition();
8890

8991
if (this.prevLastReportedPosition != lastReportedPosition) {
@@ -103,8 +105,6 @@ protected void onTick() {
103105
this.listeners.forEach(listener -> listener.onPositionChanged(this.currentPosition));
104106
}
105107
}
106-
107-
this.hasTrackPosition = true;
108108
} else {
109109
this.currentPosition = -1;
110110
this.hasTrackPosition = false;
@@ -189,6 +189,10 @@ public void stop() {
189189
this.process.close();
190190
this.process = null;
191191
}
192+
193+
this.currentTrack = null;
194+
this.currentPosition = -1;
195+
this.hasTrackPosition = false;
192196
}
193197

194198
}

0 commit comments

Comments
 (0)