feat(android): surface queue source on PlayerUiState

Reads MINSTREL_SOURCE_KEY from the current MediaItem's extras and
projects it as PlayerUiState.currentSource. PlayEventsReporter
needs this to tag plays with their originating system playlist
('for_you'/'discover'/'radio:<id>') so the server advances the
right rotation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-26 14:02:06 -04:00
parent 92c128e388
commit c396b673ac
2 changed files with 6 additions and 0 deletions
@@ -156,6 +156,10 @@ class PlayerController @Inject constructor(
override fun onEvents(player: Player, events: Player.Events) {
val idx = player.currentMediaItemIndex
val current = queueRefs.getOrNull(idx)
val source = player.currentMediaItem
?.mediaMetadata
?.extras
?.getString(MINSTREL_SOURCE_KEY)
uiStateInternal.value =
PlayerUiState(
currentTrack = current,
@@ -167,6 +171,7 @@ class PlayerController @Inject constructor(
durationMs = player.duration.coerceAtLeast(0),
bufferedPositionMs = player.bufferedPosition.coerceAtLeast(0),
playbackError = player.playerError?.message,
currentSource = source,
)
}
},
@@ -18,4 +18,5 @@ data class PlayerUiState(
val durationMs: Long = 0,
val bufferedPositionMs: Long = 0,
val playbackError: String? = null,
val currentSource: String? = null,
)