Skip to content

Controller fails to display non-String text metadata #2853

Closed

Description

@Sonphil

Version

Media3 1.8.0

More version details

No response

Devices that reproduce the issue

Android Auto

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Yes

Reproduction steps

Play a MediaItem where the MediaMetadata contains a non-string text.

For example, change the title like so:

Image

Expected result

Before, the title would be displayed:

Image

This allowed the app to pass any type of CharSequence, enabling some basic formatting.

Actual result

The title is not displayed since it's not a String.

Image
Key android.media.metadata.TITLE expected String but value was a android.text.SpannableStringBuilder.  The default value <null> was returned.
Attempt to cast generated internal exception: (Ask Gemini)
java.lang.ClassCastException: android.text.SpannableStringBuilder cannot be cast to java.lang.String
at android.os.BaseBundle.getString(BaseBundle.java:1446)
at androidx.media3.session.legacy.MediaMetadataCompat.getMediaMetadata(MediaMetadataCompat.java:489)
at androidx.media3.session.legacy.MediaSessionCompat$MediaSessionImplApi21.setMetadata(MediaSessionCompat.java:2069)
at androidx.media3.session.legacy.MediaSessionCompat.setMetadata(MediaSessionCompat.java:538)
at androidx.media3.session.MediaSessionLegacyStub.setMetadata(MediaSessionLegacyStub.java:1171)
at androidx.media3.session.MediaSessionLegacyStub.access$1700(MediaSessionLegacyStub.java:118)
at androidx.media3.session.MediaSessionLegacyStub$ControllerLegacyCbForBroadcast.updateMetadataIfChanged(MediaSessionLegacyStub.java:1700)
at androidx.media3.session.MediaSessionLegacyStub$ControllerLegacyCbForBroadcast.onMediaMetadataChanged(MediaSessionLegacyStub.java:1493)
at androidx.media3.session.MediaSessionImpl$PlayerListener.lambda$onMediaMetadataChanged$22(MediaSessionImpl.java:1990)
at androidx.media3.session.MediaSessionImpl$PlayerListener$$ExternalSyntheticLambda13.run(D8$$SyntheticClass:0)
at androidx.media3.session.MediaSessionImpl.dispatchRemoteControllerTaskToLegacyStub(MediaSessionImpl.java:1193)
at androidx.media3.session.MediaSessionImpl.access$400(MediaSessionImpl.java:98)
at androidx.media3.session.MediaSessionImpl$PlayerListener.onMediaMetadataChanged(MediaSessionImpl.java:1989)
at androidx.media3.common.ForwardingPlayer$ForwardingListener.onMediaMetadataChanged(ForwardingPlayer.java:892)
at androidx.media3.exoplayer.ExoPlayerImpl.lambda$updatePlaybackInfo$20(ExoPlayerImpl.java:2192)
at androidx.media3.exoplayer.ExoPlayerImpl$$ExternalSyntheticLambda1.invoke(D8$$SyntheticClass:0)
at androidx.media3.common.util.ListenerSet$ListenerHolder.invoke(ListenerSet.java:342)
at androidx.media3.common.util.ListenerSet.lambda$queueEvent$0(ListenerSet.java:226)
at androidx.media3.common.util.ListenerSet$$ExternalSyntheticLambda1.run(D8$$SyntheticClass:0)
at androidx.media3.common.util.ListenerSet.flushEvents(ListenerSet.java:248)
at androidx.media3.exoplayer.ExoPlayerImpl.updatePlaybackInfo(ExoPlayerImpl.java:2242)
at androidx.media3.exoplayer.ExoPlayerImpl.handlePlaybackInfo(ExoPlayerImpl.java:2076)
at androidx.media3.exoplayer.ExoPlayerImpl.lambda$new$1$androidx-media3-exoplayer-ExoPlayerImpl(ExoPlayerImpl.java:353)
at androidx.media3.exoplayer.ExoPlayerImpl$$ExternalSyntheticLambda12.run(D8$$SyntheticClass:0)
at android.os.Handler.handleCallback(Handler.java:1041)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.dispatchMessage(Looper.java:315)
at android.os.Looper.loopOnce(Looper.java:251)
at android.os.Looper.loop(Looper.java:349)
at android.app.ActivityThread.main(ActivityThread.java:9041)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:593)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:929)

Media

Any media in the demo-session-service module

Bug Report

Activity

  1. self-assigned this
    on Oct 17, 2025
  2. icbaker commented on Oct 17, 2025

    @icbaker
    Collaborator

    Thanks for reporting, and for the clear repro instructions. I've sent a fix for internal review.

  3. icbaker commented on Oct 21, 2025

    @icbaker
    Collaborator

    This is fixed by the commit linked above.

  4. locked and limited conversation to collaborators on Jan 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions