fix: elapsed time continues ticking whilst paused/not playing

Fixes: https://github.com/acaloiaro/di-tui/issues/39
This commit is contained in:
Adriano Caloiaro 2026-04-25 09:48:17 -06:00
parent 504b46e6f5
commit 3e1aa36090
No known key found for this signature in database

View file

@ -163,6 +163,10 @@ func configureEventHandling() {
go func() { go func() {
c := time.Tick(1 * time.Second) c := time.Tick(1 * time.Second)
for range c { for range c {
// don't show elapsed time updates when playback is paused/not playing
if !ctx.IsPlaying {
continue
}
elapsed := time.Since(ctx.View.NowPlaying.Track.StartTime) elapsed := time.Since(ctx.View.NowPlaying.Track.StartTime)
// If the current time is past the end of the track, then a new track is playing and the now playing track needs // If the current time is past the end of the track, then a new track is playing and the now playing track needs