+5
−0
+1
−0
+11
−3
Loading
Xcode's Thread Performance Checker flagged AVAudioSession.setActive on
the main thread. It was called at launch, which had a second effect the
checker does not report: opening the app silenced whatever another app
was playing, before anything had been asked of it.
The category is still declared at launch; the session is now activated
just before playback starts or resumes — a new episode, an intent, the
end of an interruption — on a serial queue of its own, so neither call
holds up the main thread and the category always comes first.
Also clears the five compiler warnings of the package: the tunables of
SilenceSkippingEngine, read from its detached analysis task, are
immutable constants and say so with nonisolated; and DateFormatter is
Sendable, so its nonisolated(unsafe) goes.
Verified on an iOS 27 simulator: at launch, only the category is set,
off the main thread; playing an episode from the app, and from a widget
with the app terminated, activates the session off the main thread
before playback starts. Not seen on a device: that other apps' audio now
survives opening the app, and the resume after a call.
Co-Authored-By:
Claude Opus 5.5 <noreply@anthropic.com>