services/audioSessionManager.ts

OGAM · src/services/audioSessionManager.ts · typescript · MIT
voice

Provides a single owner for iOS AVAudioSession, coordinating playback and recording modes in React Native apps.

// Source: https://github.com/off-grid-ai/OGAM | License: MIT | Copyright 2026 Mohammed Ali Chherawalla
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * AudioSessionManager — the single owner of the iOS AVAudioSession.
 *
 * Before this existed, the session was configured from two unrelated places (the
 * recorder set `playAndRecord`, the Kokoro TTS bridge set `playback`) with no
 * coordination and no restore, so whichever ran last decided the category — which
 * is why playback was sometimes silent (a `record`-only or stale session routes
 * AudioContext output nowhere on iOS). Every code path that needs the session now
 * goes through here, so there is exactly one owner of its category + activation.
 *
 * iOS-only: on Android there is no equivalent session to mana

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key