Repository navigation
iOS: play the book alongside other apps' audio (mix modes, book level, lock screen card) - #446
Open
soumojitdas wants to merge 2 commits into
Open
soumojitdas wants to merge 2 commits into
soumojitdas wants to merge 2 commits into
Conversation
…to balance the two Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l Center while it mixes with another app Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
An iOS option to play the book over another app's audio instead of pausing it: classical music in YouTube under an audiobook, say. It is off by default, so nothing changes unless someone switches it on.
What it adds
AudioPlaybackIntents) and an iOS 18 play/pause control.How
AbsorbAudioMix(in theAbsorbPlayerCorepackage, so the widget intents can use it) holds the setting and makes the decision. Every place that sets the session category goes through itsapply(): launch,AbsorbAudioEngine,IOSQueueAdvancer, the native core, the intents andNowPlayingPrimer. Mixing needs.mixWithOthers, and Apple allows no category options under.longFormAudio, so a mixing session uses the default route policy.audio_sessionconfigure, and everysetActive(true)now goes through_activateAudioSession(), which has native apply the decision first. Without that, resuming a book that last played alone re-activated the exclusive category and stopped the other app.NowPlayingPrimerskips its claim while mixing: a mixing session can't hold Now Playing, and with ducking on the blip would leave the other app turned down. With ducking on, the engine also deactivates the session on pause so the other app gets its volume back.BookLiveActivityControllerstarts it from the foreground (iOS only lets an app start one there), updates it from the same app-group keys the home screen widgets read plus the engine's state, and only pushes an update on a visible change, since the progress bar runs on its own.Testing
iPhone 14 Pro on iOS 27.0.1 with YouTube and Audiobookshelf 2.37.1, built with Xcode 27.1 and Flutter 3.47.7 and installed under a different bundle ID with free provisioning (so without CarPlay and Siri). The audio daemon's session log shows the book activating as a mixable session without interrupting YouTube, and resume keeping it mixable; the book level and the Live Activity were checked on the phone. Each commit builds on its own.
Android is untouched: the Dart changes sit behind
Platform.isIOSand the Mix button is hidden there, but I couldn't run an Android build. The new strings are English-only, like the Android "Duck brief interruptions" toggle; happy to move them into the ARB files if you'd rather.Two commits: mixing with the book level, then the Live Activity and control.
🤖 Generated with Claude Code