-
Notifications
You must be signed in to change notification settings - Fork 313
Description
Describe the bug
We are experiencing an intermittent production crash related to audio playback using the Stream Chat Android Compose SDK.
The crash occurs when tapping on an audio message attachment. The SDK attempts to play a cached audio file, but the file no longer exists at the expected path inside cache/stream_cache.
This results in a FileNotFoundException thrown from MediaPlayer.setDataSource, which ultimately crashes the app.
Root exception
Caused by java.io.FileNotFoundException:
/data/user/0/br.lgfelicio/cache/stream_cache/audio_recording_Wed Nov 19 16:51:17 GMT-03:00 2025.aac:
open failed: ENOENT (No such file or directory)
Caused by:
android.system.ErrnoException: open failed: ENOENT (No such file or directory)
Relevant stack trace
android.media.MediaPlayer.setDataSource
io.getstream.chat.android.client.audio.NativeMediaPlayerImpl.setDataSource (NativeMediaPlayer.kt:414)
io.getstream.chat.android.client.audio.StreamMediaPlayer.setAudio (StreamAudioPlayer.kt:247)
io.getstream.chat.android.client.audio.StreamMediaPlayer.play (StreamAudioPlayer.kt:127)
io.getstream.chat.android.ui.common.feature.messages.list.AudioPlayerController.play (AudioPlayerController.kt:212)
io.getstream.chat.android.ui.common.feature.messages.list.AudioPlayerController.togglePlayback (AudioPlayerController.kt:90)
io.getstream.chat.android.compose.viewmodel.messages.AudioPlayerViewModel.playOrPause (AudioPlayerViewModel.kt:49)
io.getstream.chat.android.compose.ui.attachments.content.AudioRecordAttachmentContent
The crash is triggered from a click event inside AudioRecordAttachmentContent in Compose.
Observed behavior
The audio file path points to the stream_cache directory.
- The file does not exist at the time
MediaPlayer.setDataSource()is called. - The SDK does not seem to handle the missing file gracefully.
- The exception propagates and crashes the entire application.
Expected behavior
If the cached audio file is missing, the SDK should:
Either re-download the file before attempting playback
Or fail gracefully (e.g., emit an error state to the UI)
- But not crash the app
SDK version
6.23.0
App version
11.181.0 (production)
Platform
- Android
- Mostly reported on Android 14 (based on Crashlytics distribution)
- Various vendors (Samsung majority, also others)
To Reproduce
We were not able to reliably reproduce this locally.
Based on Crashlytics patterns, it seems to happen when:
- Opening a channel containing audio attachments
- Quickly tapping on audio messages
- Potentially after cache cleanup by the system
This suggests a possible race condition between:
- Cache eviction / file cleanup
- And playback initialization
Additional context
This crash is intermittent but recurring in production.
It affects multiple users.
It appears to be specifically related to audio attachments recorded via Stream.
- The failure happens during
MediaPlayer.setDataSource()before playback starts.

