some-dream-34600
10/10/2025, 10:33 AMtall-airline-16756
10/10/2025, 10:33 AMtall-airline-16756
10/10/2025, 10:33 AMsome-dream-34600
10/10/2025, 10:34 AMtall-airline-16756
10/10/2025, 10:34 AMLiveKitOverrides class when creating a Room object. Let’s take a look at how you can do this:
• Using Predefined Audio Types: The simplest and most recommended way is to use the MediaAudioType for media playback. Here’s how you can set it up: val room = LiveKit.create(
appContext = application,
overrides = LiveKitOverrides(
audioOptions = AudioOptions(
audioOutputType = AudioType.MediaAudioType()
)
)
)
• Customizing Audio Attributes: If you want more control over your audio settings, you can use CustomAudioType to define specific audio attributes tailored to your needs: val audioAttributes = AudioAttributes.Builder()
.setUsage(AudioAttributes.USAGE_MEDIA)
.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
.build()
val customAudioType = AudioType.CustomAudioType(
audioMode = AudioManager.MODE_NORMAL,
audioAttributes = audioAttributes,
audioStreamType = AudioManager.STREAM_MUSIC
)
val room = LiveKit.create(
appContext = application,
overrides = LiveKitOverrides(
audioOptions = AudioOptions(
audioOutputType = customAudioType
)
)
)
• Optional Audio Focus Management: For even more advanced control, you might find AudioFocusHandler useful to manage audio focus effectively: val audioHandler = AudioFocusHandler(context).apply {
focusMode = AudioManager.AUDIOFOCUS_GAIN
audioAttributeUsageType = AudioAttributes.USAGE_MEDIA
audioAttributeContentType = AudioAttributes.CONTENT_TYPE_MUSIC
}
val room = LiveKit.create(
appContext = application,
overrides = LiveKitOverrides(
audioOptions = AudioOptions(
audioHandler = audioHandler,
audioOutputType = AudioType.MediaAudioType()
)
)
)
I hope this helps you make the switch smoothly! If you have any questions or need more help with any part of this, please don’t hesitate to ask. I’m here to support you! Sources: README.md | README.mdsome-dream-34600
10/13/2025, 5:08 AMtall-airline-16756
10/13/2025, 5:09 AMval customAudioType = AudioType.CustomAudioType(
audioMode = AudioManager.MODE_IN_COMMUNICATION,
audioAttributes = null, // Optional for older devices
audioStreamType = AudioManager.STREAM_VOICE_CALL
)
val room = LiveKit.create(
appContext = application,
overrides = LiveKitOverrides(
audioOptions = AudioOptions(
audioOutputType = customAudioType
)
)
)
• Force Audio Routing: If you’re facing issues on certain devices, enabling forced routing can help: val audioHandler = AudioFocusHandler(context).apply {
forceHandleAudioRouting = true
}
val room = LiveKit.create(
appContext = application,
overrides = LiveKitOverrides(
audioOptions = AudioOptions(
audioHandler = audioHandler
)
)
)
• Maintain Communication Mode: Using a silent AudioTrack can prevent Android from resetting MODE_IN_COMMUNICATION after some inactivity: val audioOptions = AudioOptions(
disableCommunicationModeWorkaround = false // Default behavior
)
• Preferred Device List: You can customize the priority order for audio output devices like this: audioSwitchHandler.preferredDeviceList = listOf(
AudioDevice.Speakerphone::class.java,
AudioDevice.Earpiece::class.java,
AudioDevice.BluetoothHeadset::class.java
)
I hope these tips help your setup work smoothly on older devices! If you have any more questions or need a hand with anything else, just let me know—I’m here for you. Sources: livekit-android-sdk/src/main/java/io/livekit/android/LiveKitOverrides.kt | android/src/main/java/com/livekit/reactnative/LivekitReactNativeModule.kt