Skip to content

Show how far into its song a radio stream is, when the stream knows - #1266

Merged
formatBCE merged 1 commit into
music-assistant:mainfrom
culmat:radio-song-progress
Oct 26, 2026
Merged

formatBCE merged 1 commit into
music-assistant:mainfrom
culmat:radio-song-progress

Conversation

@culmat

@culmat culmat commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Closes #1264

It goes through the existing progress logic: PlayerPositionTracker stays the one source of the position, for the player, the notification, Android Auto and Now Playing.

  • PlayerPositionTracker.setSong keeps a second anchor per queue for the song a radio stream reports. Readers get it over the queue's anchor, except while an optimistic seek or track change is frozen. Queue-time events keep updating the queue's anchor underneath, and it shows again once the song report goes. No existing setAnchor call changed.
  • MainDataSource passes each queue's song timing to the tracker just before the players publish, and only when the player's media belongs to the queue's current item.
  • PlayerFactory gives radio media a duration only when the stream reports a song position, so every surface shows the song's length from currentMedia.duration as for any track.
  • Radio stays not seekable: the slider has no thumb, and the Android media session no longer offers seeking for radio (iOS already did not).
  • Tests: tracker tests for song position and length, queue time not moving the song, its return, pause, and a freeze winning; RadioSongTimingTest; an Android test for the duration and the missing seek action.

Normal tracks, audiobooks, podcasts and radio without a song report behave as before.

The server reports a song's position for a radio stream since music-assistant/server#7187. The web app gets the same in music-assistant/frontend#3042. See also https://github.com/orgs/music-assistant/discussions/6876: showing what a radio station plays, which this is one part of.

Are there any additional changes not related to the issue above?

No.

Before submitting this PR, make sure you have:

  • Given this PR a readable name that can be used in the app's changelog
  • Made sure checks pass by running ./gradlew detektAll testAndroidHostTest :androidApp:testDebug

A radio provider can report each song's duration and the position in it.
The app dropped the duration of radio and timed it by the queue, which
counts from when the station was tuned in. The position tracker now times
such a queue by the song, so the player, the notification, Android Auto and
Now Playing show the song's position and length. The queue time returns
when the song report goes. A radio stream still cannot seek.

@formatBCE formatBCE left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it

@formatBCE
formatBCE merged commit 54e1d4f into music-assistant:main Oct 26, 2026
3 checks passed
@formatBCE

Copy link
Copy Markdown
Collaborator

Thank you @culmat!

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.

Show how far into its song a radio stream is

2 participants