Skip to content

AttachmentMediaActivity crashes when opening .m4a files: ClassCastException between com.google.android.exoplayer2 and androidx.media3 #5995

@nabeelismail30

Description

@nabeelismail30

Describe the bug
When opening an .m4a attachment in the Stream Chat SDK’s AttachmentMediaActivity, the app crashes with an InflateException and a ClassCastException.
The crash occurs because androidx.media3.ui.PlayerView attempts to cast com.google.android.exoplayer2.ui.AspectRatioFrameLayout (from the old ExoPlayer package) to androidx.media3.ui.AspectRatioFrameLayout.
This indicates a dependency conflict between the legacy ExoPlayer (com.google.android.exoplayer2) and Media3 (androidx.media3) libraries used internally by the SDK.

Caused by: java.lang.ClassCastException: com.google.android.exoplayer2.ui.AspectRatioFrameLayout cannot be cast to androidx.media3.ui.AspectRatioFrameLayout

SDK version

  • "6.24.0" - Android SDK

To Reproduce
Steps to reproduce the behavior:

  1. Launch the chat and open a message with an .m4a audio attachment or upload any m4a file in the chat message.
  2. Tap on the audio to open the gallery/media viewer (AttachmentMediaActivity).
  3. The app crashes during layout inflation of stream_ui_activity_attachment_media.

Expected behavior
The media viewer should open and play the .m4a audio file normally without crashing.

Device:
Vendor and model: Samsung Galaxy A52, Google Pixel 8a
Android version: Android 14, Android 15

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions