Skip to content

Commit

Permalink
Fix current time second when not playing
Browse files Browse the repository at this point in the history
  • Loading branch information
kaaholst committed Jun 12, 2024
1 parent b45e637 commit 2620b6a
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,13 @@ public long getPosition() {
}

private double calcPosition() {
double now = SystemClock.elapsedRealtime() / 1000.0;
double trackCorrection = rate * (now - statusSeen);
return trackCorrection <= 0 ? currentTimeSecond : currentTimeSecond + trackCorrection;
if (isPlaying()) {
double now = SystemClock.elapsedRealtime() / 1000.0;
double trackCorrection = rate * (now - statusSeen);
return trackCorrection <= 0 ? currentTimeSecond : currentTimeSecond + trackCorrection;
} else {
return currentTimeSecond;
}
}

public int getCurrentSongDuration() {
Expand Down

0 comments on commit 2620b6a

Please sign in to comment.