worried-gold-23479
11/24/2025, 2:48 PMtall-airline-16756
11/24/2025, 2:48 PMtall-airline-16756
11/24/2025, 2:49 PMflutter_background_service) alongside LiveKit?
3. Is the pre-connect buffering explicitly enabled in your client code (e.g., withPreconnectAudio or equivalent)?
4. Are microphone permissions confirmed and granted at runtime on the device? (iOS Info.plist, Android AndroidManifest.xml)
5. Can you reproduce this consistently on a single platform/device or is it intermittent across multiple devices?
Immediate actions you can try
• Ensure pre-connect audio is enabled in your platform code (use withPreconnectAudio or the SDK equivalent).
• Verify microphone permissions are declared and granted on the device.
• If using Flutter on iOS, remove or disable background/audio-interfering plugins (e.g., flutter_background_service) to rule out plugin conflicts.
• Set bypassVoiceProcessing explicitly (try false) during SDK initialization so echo cancellation/AGC/noise suppression run consistently.
• Test on a device without extra audio plugins to see if the issue persists; this isolates SDK vs app/plugin interactions.
• If possible, upgrade the SDK from 2.23.0 to the latest patch — known mobile audio issues have been fixed in later releases.
If you tell me the platform and your answers to the questions above, I’ll give exact code locations and the next steps to test and fix this.
Sources: Agent speech and audio | LiveKit docs | [Flutter iOS] SoundWaveformWidget / AudioVisualizerWidget Not Working (Miss... | Mobile SDKs (Flutter, iOS, Android) | livekit/livekit_composite | DeepWiki | Android quickstart | LiveKit docsworried-gold-23479
11/24/2025, 2:55 PMtall-airline-16756
11/24/2025, 2:56 PMwithPreconnectAudio { ... } so the SDK starts capturing mic audio while connecting. Example:
room.withPreconnectAudio {
val (url, token) = tokenService.fetchConnectionDetails()
room.connect(url = url, token = token)
}
1. Ensure you request RECORD_AUDIO at runtime (manifest + runtime prompt).
2. Don’t manually call setMicrophoneEnabled(true) before/inside withPreconnectAudio — let withPreconnectAudio manage the mic.
3. If the problem persists after enabling withPreconnectAudio, try updating from 2.23.0 to a newer SDK build (mobile audio fixes were made in later releases).
If you want, paste the snippet where you connect to the room and I’ll point out exactly where to add withPreconnectAudio and any small changes to verify.
Sources: Agent speech and audio | LiveKit docs | Android quickstart | LiveKit docsworried-gold-23479
11/24/2025, 3:04 PMtall-airline-16756
11/24/2025, 3:04 PMwithPreconnectAudio { ... } around your room connect call and test on the Android 14 device? If you did and it still fails, please paste the connect snippet (or describe any errors/log output) and I’ll point out exactly what to change and what to inspect next.worried-gold-23479
11/24/2025, 3:06 PMtall-airline-16756
11/24/2025, 3:06 PMwithPreconnectAudio { ... }. Put the wrapper immediately before you call room.connect(...) so the SDK starts the mic capture while the connection completes.
Example placement in a typical flow:
// obtain url/token first (or inside the block if you fetch there)
val (url, token) = tokenService.fetchConnectionDetails()
// start pre-connect audio, then connect
room.withPreconnectAudio {
room.connect(
url = url,
token = token,
// any other connect options you already use
)
}
If you fetch the token asynchronously inside the block, do that instead:
room.withPreconnectAudio {
val (url, token) = tokenService.fetchConnectionDetails()
room.connect(url = url, token = token)
}
What to check after adding:
• Ensure you are not calling setMicrophoneEnabled(true) before or instead of this block.
• Confirm runtime RECORD_AUDIO permission is granted on Android 14.
• Watch logs for any errors during withPreconnectAudio or room.connect.
Paste your current connect snippet if you want me to insert the exact lines for your code.worried-gold-23479
11/24/2025, 3:08 PMtall-airline-16756
11/24/2025, 3:08 PMroom.connect(...) (or the surrounding function). I’ll insert the exact withPreconnectAudio { ... } placement and any small fixes for Android 14.worried-gold-23479
11/24/2025, 3:15 PMtall-airline-16756
11/24/2025, 3:15 PMwithPreconnectAudio { ... } around the call to newRoom.connect(...) so microphone capture starts while the room is connecting. Replace your current connect block with this pattern:
// start pre-connect audio, then connect
newRoom.withPreconnectAudio {
// perform the connect while mic is being buffered
withTimeout(CONNECTION_TIMEOUT) {
newRoom.connect(
url = connectionDetails.url,
token = connectionDetails.token,
options = ConnectOptions()
)
}
}
Minimal integrated change in your function (showing context):
val newRoom = LiveKit.create(appContext = context, overrides = liveKitOverrides)
this@LiveKitWrapper.room = newRoom
// START: enable pre-connect audio here
newRoom.withPreconnectAudio {
withTimeout(CONNECTION_TIMEOUT) {
newRoom.connect(
url = connectionDetails.url,
token = connectionDetails.token,
options = ConnectOptions()
)
}
}
// END
// Setup event listeners BEFORE enabling microphone
setupEventListeners()
// existing microphone enable loop...
Notes:
• Don’t call setMicrophoneEnabled(true) before or instead of withPreconnectAudio — let the block handle initial capture.
• Keep your runtime RECORD_AUDIO permission checks.
• Test on the Android 14 device after this change and share logs or the connect snippet if buffering still fails.