Skip to content

Fix now-playing UI showing wrong song (issue #24)#25

Merged
chamika merged 1 commit into
mainfrom
fix-nowplaying-desync-issue-24
Jun 28, 2026
Merged

Fix now-playing UI showing wrong song (issue #24)#25
chamika merged 1 commit into
mainfrom
fix-nowplaying-desync-issue-24

Conversation

@chamika

@chamika chamika commented Jun 28, 2026

Copy link
Copy Markdown
Owner

Fixes #24

Problem

The AAOS full player screen and the browse "now playing" indicator occasionally disagree about the current track — sometimes the player shows the previous song while the browse view shows the real one, and sometimes the reverse. It's intermittent and happens in both directions.

Root cause

This is a sync/timing bug, not a wrong-value bug:

  • Browse items and queue items both go through the same MediaItemFactory / MediaRepository.toMediaItem() path, so a given track always has identical title/art.
  • Media3 precedence is in our favor — Player.getMediaMetadata() populates MediaItem.mediaMetadata on top of media-derived metadata, so our title always wins. In-band ID3 can never substitute a different song's title.
  • DashTune streams Jellyfin's transcoded MP3. ExoPlayer's Mp3Extractor parses the embedded ID3 tags and fires an extra onMediaMetadataChanged shortly after each transition, re-publishing MediaMetadataCompat to the legacy MediaSessionCompat bridge. When a late ID3 event for track B interleaves with the transition to track C, the two AAOS now-playing surfaces refresh on different events and end up disagreeing.

Fix

Disable ID3 metadata extraction on the MP3 streams. The app fully owns now-playing metadata via MediaItem.mediaMetadata, so the in-band ID3 pass is pure churn — removing it collapses each transition to a single, clean metadata publish.

Also adds an onMediaMetadataChanged debug log to confirm, in a reproduction, that each transition now yields exactly one metadata change matching the current item id.

No new Gradle dependency (extractor ships transitively with media3-exoplayer 1.9.2).

Verification

  • ./gradlew :automotive:assembleDebug builds cleanly.
  • On-device: play an album/playlist, let it auto-advance and rapidly skip Next/Previous, and confirm the full player title always matches the highlighted browse item. logcat should show exactly one onMediaMetadataChanged per transition with currentId matching the title.

🤖 Generated with Claude Code

Disable ID3 metadata parsing on the transcoded MP3 streams. The app fully
owns now-playing metadata via MediaItem.mediaMetadata, so ExoPlayer's in-band
ID3 pass only adds a redundant, late onMediaMetadataChanged event per
transition. That extra publish races the AAOS Media Center's two now-playing
surfaces (full player title vs browse highlight), intermittently leaving them
showing different tracks.

Also add a debug log in onMediaMetadataChanged to confirm each transition
produces a single clean metadata publish matching the current item id.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@chamika chamika merged commit 9bb3629 into main Jun 28, 2026
1 check passed
@chamika chamika deleted the fix-nowplaying-desync-issue-24 branch June 28, 2026 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The player UI not showing the currently playing song occasionally.

1 participant