manageCallAudio: true) so calls “just
work” on both platforms — including the notorious iOS WKWebView dead-microphone bug.
The one rule
The system activates the call’s audio session when a call is answered or started. If your WebView starts capturing (getUserMedia) before that activation, the capture binds to a
session the system then re-hands-over, and it records silence — “the remote side can’t hear me
until I toggle the mic.”
RingKit removes the guesswork: start your media only when RingKit says the session is active.
example/www/call-audio.js: the media gate plus mute / speaker / hold / end controls and device
selection.
Routing, proximity, hold, devices
- iOS sets the category (
.playAndRecord, mode.voiceChat/.videoChat) before the call is answered/started and never re-sets it on the active session — which is exactly what avoids the stall. It re-asserts your chosen route after WebKit’s mid-call session churn and respects external outputs (headphones / Bluetooth / CarPlay). - Android — while ringing, the full-screen fallback takes transient audio focus, so the
ringtone pauses the user’s music or another VoIP app. On answer (or when an outgoing call
connects via
reportCallConnected) RingKit takes exclusive focus and setsMODE_IN_COMMUNICATION; on every teardown path (decline / timeout / remote end / answer in app / end) it releases focus and restores the mode — exactly once, so it can never leak and leave the user’s music muted. Routing usessetCommunicationDeviceon Android 12+ and the legacy speakerphone / Bluetooth SCO APIs below that. Proximity blackout is handled natively while on the earpiece, sosetProximityMonitoringis a successful no-op there.
Bluetooth on Android 12+: listing or selecting a specific Bluetooth device needs the
runtime
BLUETOOTH_CONNECT permission — request it before offering a Bluetooth route.
Without it RingKit still routes to earpiece / speaker. (MODIFY_AUDIO_SETTINGS, needed for the
audio mode and route, merges in automatically and is auto-granted.)Outgoing calls
startCall reports the call to CallKit / self-managed Telecom, so the OS shows the in-call UI,
writes a call-log entry, and RingKit owns the audio session. It emits callStarted when the OS
accepts the call. On Android it places a self-managed Telecom call, which needs
MANAGE_OWN_CALLS — already merged in by the plugin.
When to turn it off
If a native media SDK already owns the audio session (a native LiveKit/Agora/Twilio/Vonage bridge — not the WebView), two managers would fight. Two options:callAudioMode: 'observe'— RingKit still emitsaudioSessionActivated/Deactivated,callHeld/UnheldandaudioRouteChanged(so you keep the “safe to start” gate) but does not touch the category or route.manageCallAudio: false— the module is fully off.
observe/false for a ring-only app that never captures audio, so .playAndRecord
doesn’t trigger a needless microphone prompt on iOS.