mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
BugFix: Forward and Backward buttons
This commit is contained in:
parent
cc6577d4bc
commit
f89d5b2c4b
1 changed files with 12 additions and 0 deletions
|
|
@ -515,6 +515,18 @@ class MusicManager: ObservableObject {
|
|||
guard duration > 0 else { return }
|
||||
|
||||
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)
|
||||
seek(to: target)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue