Two fixes: Snap-back on seek end: Previously isScrubbing = false was set immediately after seekToPercent(pct). AVPlayer.seek is asynchronous — currentTime doesn’t update instantly. So displayProgress switched from scrubPosition back to the old playbackTime / playbackDuration for up to 250ms until the timer polled again, causing a visible snap-back. Now scrubPosition is held at pct and isScrubbing clears after a 150ms delay — enough time for AVPlayer to confirm the seek position before the bar resumes tracking currentTime. Stale timer poller removed: playbackTime and playbackDuration were @State vars updated by a Timer.publish every 0.25s. Since currentTime and duration are already @Published on AudioPlayer, the timer was just adding lag and a secondary update cycle. They’re now computed properties reading directly from audioPlayer.currentTime and audioPlayer.duration — updates arrive instantly via SwiftUI’s observation, same as the full Now Playing view. |
||
|---|---|---|
| .. | ||
| App | ||
| Data | ||
| Resources | ||
| Views | ||