feat(audio): AudioManager audio session management#1108
Draft
hiroshihorie wants to merge 2 commits into
Draft
Conversation
Process-wide audio session control on AudioManager: session options and management modes (automatic/manual), Android audio session configuration (mode/focus/routing) backed by an AudioSwitch-based manager in the native plugin, Apple speakerphone routing, and speaker output preferences. Platform audio sessions are global to the app process, so this lives on AudioManager rather than Room.
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.
What
First-class, process-wide audio session control on
AudioManager— replacing session/routing behavior that was scattered acrossHardware,track/audio_management.dart, and implicit native defaults.API
Typed session configuration —
AudioSessionOptionswithcommunication()/media()presets and per-platform escape hatches:AppleAudioSessionConfiguration: category / mode / category optionsAndroidAudioSessionConfiguration: audio mode, focus mode, stream type, audio attributes usage/content typesAutomatic vs manual management —
AudioSessionManagementMode. Defaultautomaticpreserves today's behavior (the SDK tracks local/remote audio presence and configures the session).manuallets apps that own their audio lifecycle drive it themselves.Android session backend — a new AudioSwitch-based
LKAudioSwitchManagerin the native plugin handles device routing, audio focus acquisition/release, and communication-device management, driven byconfigureAndroidAudioSession/stopAndroidAudioSessionchannel methods.Unified speakerphone/routing —
setSpeakerphoneOn,preferSpeakerOutput,forceSpeakerOutputmove toAudioManagerwith consistent Apple (overrideOutputAudioPort) and Android (AudioSwitch) implementations.Compatibility
Hardware's audio members become deprecated forwarders toAudioManager— migration, not removal.RoomusesAudioManagerinternally; no behavior change for apps that touch nothing.Why AudioManager
Platform audio sessions are global to the app process — they cannot be per-
Roomor per-track. This is the second half of makingAudioManagerthe home for process-wide audio: #1107 added the engine-wide processing state read-back, this adds session/routing control — mirroring the Swift SDK'sAudioManager.Notes
AudioManagersurfaces are unified in one class.minor type="added").