BugFix: Forward and Backward buttons

This commit is contained in:
Hariharan Mudaliar 2025-11-20 15:25:11 +05:30
commit f89d5b2c4b

View file

@ -515,6 +515,18 @@ class MusicManager: ObservableObject {
guard duration > 0 else { return } guard duration > 0 else { return }
let current = estimatedPlaybackPosition() let current = estimatedPlaybackPosition()
let magnitude = abs(offset)
if offset < 0, current <= magnitude {
previousTrack()
return
}
if offset > 0, (duration - current) <= magnitude {
nextTrack()
return
}
let target = min(max(0, current + offset), duration) let target = min(max(0, current + offset), duration)
seek(to: target) seek(to: target)
} }