feat(voice): OS media controls for listening playback - #179
Merged
Conversation
Lock screen and Control Center controls on mobile, media keys and Now Playing on web and desktop, bound to the app-scoped listening player. Archiving a thread disarms the OS surface without breaking in-app resume; the next explicit play re-arms it. JS-only on mobile (the expo-audio plugin already ships background playback in current builds).
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 freeto 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.
Listening playback had no presence outside the app. Backgrounding the mobile app or switching desktop windows meant no way to pause or scrub without coming back, and Android killed background audio after about three minutes.
Playback now registers with the OS on every platform. Mobile gets lock-screen and Control Center controls through expo-audio's lock-screen API, with background playback enabled; the change is JS-only because the expo-audio config plugin already ships the required native entitlements, so it can go out as an OTA update. Web and desktop wire navigator.mediaSession into the shared audio controller, which Chromium bridges to macOS Now Playing, hardware media keys, and headset controls.
The OS surface follows the same ownership rules as the in-app one. Archiving a thread disarms it (an armed flag on web, mirroring the mobile lock-screen flag), so a media key cannot resume audio for a thread whose pause controls just left the screen, while the sidebar resume control keeps working after an unarchive. Deleting the thread clears everything. Voice recording deactivates the controls on mobile and makes the play key a no-op on web. Position state publishes only on discontinuities (load, seek, rate change, play/pause, end), never per tick, and the thread title reaches the controllers through a stable getter so title generation and renames no longer touch timeline row identities.
Implemented by gpt-5.6-sol via the sol-fast agent, reviewed by Claude Opus 5 (two passes), orchestrated by Claude Fable 5 on Claude Code.