Fix ~1s audio dropout on library long-press (spurious engine configuration change) - #110
Merged
sanylax0 merged 1 commit intoJul 20, 2026
Conversation
…opout) Long-pressing a library row fires the context-menu haptic; the Taptic Engine shares the audio hardware and can post AVAudioEngineConfigurationChange while the engine is still rendering. The handler recovered unconditionally — stop + reschedule both stem players — turning a harmless notification into an audible ~1s dropout. Recover only when the engine actually stopped; real route/sample-rate changes still recover exactly as before. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013TJoWkqg8bzkGdzxWhWjWP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
Long-pressing a song row opens a context menu, which fires the system haptic. On iPhone the Taptic Engine shares the audio hardware, and engaging it can post
AVAudioEngineConfigurationChangewhile the engine is still rendering normally — a spurious notification.Our handler in
Player+AudioSession.swiftrecovered unconditionally:recoverPlayback(force: true)stops both stem players, reschedules from the current position, and restarts. That teardown/rebuild is the audible ~1-second cutout.Fix
Guard the recovery on
engine.isRunning: if the engine is still running when the notification arrives, the audio was never affected — log and skip. Real configuration changes (route switches, sample-rate changes) genuinely stop the engine, so they recover exactly as before. The interruption, route-loss, and media-services-reset paths are untouched.Device check
engine configuration change — engine still running, skipping recoveryif the spurious notification fired.🤖 Generated with Claude Code
https://claude.ai/code/session_013TJoWkqg8bzkGdzxWhWjWP
Generated by Claude Code