Skip to content

RiTune TV UI Upgrade + Metadata Resolver#5

Open
elvarHex wants to merge 1 commit into
fast4x:mainfrom
elvarHex:main
Open

RiTune TV UI Upgrade + Metadata Resolver#5
elvarHex wants to merge 1 commit into
fast4x:mainfrom
elvarHex:main

Conversation

@elvarHex

@elvarHex elvarHex commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Overview

This PR introduces a major redesign of the Now Playing UI and adds real metadata fetching (title, artist, cover art) inspired by RiPlay-like behavior using YouTube oEmbed + MusicBrainz + Cover Art Archive.


🎨 UI Changes (Player.kt)

app/src/main/java/it/fast4x/ritune/ui/Player.kt

1. Removed YouTube Video UI

  • The YouTube player is now fully hidden (1dp + alpha 0f)
  • UI behaves like a TV music player instead of a video player

2. New "Spotify for TV" Layout

  • Cover art displayed large on the left
  • Title and artist displayed on the right
  • Progress bar added with animated fill
  • Subtle dark gradient background for TV-style appearance

3. Removed Video ID display

❌ Removed:

ID: dQw4w9WgXcQ

4. Replaced with Time Display

✔ Added formatted playback time:

mm:ss / mm:ss

Example:

1:32 / 4:10

Implementation:

  • formatDuration(seconds: Float)
  • Shows current position and total duration

🧠 Metadata System (NEW)

1. TrackMetadataResolver.kt (NEW FILE)

Path:

app/src/main/java/it/fast4x/ritune/utils/TrackMetadataResolver.kt

Features:

  • Resolves metadata from YouTube mediaId
  • Uses YouTube oEmbed API (title + author + thumbnail)
  • Enhances metadata using MusicBrainz API:
    • recording search
    • artist-credit parsing
    • release lookup
  • Fetches album cover via Cover Art Archive
  • Downloads and caches bitmap cover art
  • In-memory caching to avoid repeated requests

2. Data Model

data class TrackMetadata(
    val mediaId: String,
    val title: String,
    val artist: String,
    val coverUrl: String?,
    val coverBitmap: android.graphics.Bitmap?
)

3. Metadata Flow

mediaId
  ↓
YouTube oEmbed
  ↓
MusicBrainz search (recording)
  ↓
Release lookup
  ↓
Cover Art Archive
  ↓
Final enriched metadata

Fallback:

  • If MusicBrainz fails → YouTube metadata is used
  • If everything fails → generic placeholder

⚙️ Player.kt Integration

Added:

  • trackMetadata state
  • LaunchedEffect(mediaId) fetch trigger
  • Reactive UI updates for:
    • title
    • artist
    • cover bitmap

Now uses:

TrackMetadataResolver.resolve(mediaId)

🎯 Result

The app now behaves like a TV music player:

  • No video shown
  • Large album cover
  • Clean centered metadata
  • Real artist/title when available
  • Duration display instead of video ID
  • Spotify-like Now Playing screen
What will RiTune's music player look like?

🚀 Future Improvements (Optional)

  • Display lyrics for karaoke
  • Animate cover transitions
  • Add a blurred background from the cover image, or (like on RiPlay) change the generic color to match the cover art

ℹ️ Issue #4 partially closed
ℹ️ You need to edit readme.md, with this pull, RiTune will become only audio receiver, but in the future a video mode could be added, and also lyrics of the song


⚠️ All code needs one final check and test to confirm correct functioning before a new release.

Replace YouTube video UI with TV-style Now Playing layout
Add MusicBrainz + YouTube oEmbed metadata resolver
Display cover art, title, artist, and playback duration
Remove video ID from UI
Improve progress display formatting (mm:ss / mm:ss)
@fast4x

fast4x commented Jun 16, 2026

Copy link
Copy Markdown
Owner

Notevole, e se voglio vedere un video?

@elvarHex

elvarHex commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

beh, si potrebbe aggiungere una nuova scheda, in questi giorni inizio a svilupparla e invierò un'altra PR

@fast4x

fast4x commented Jun 16, 2026

Copy link
Copy Markdown
Owner

Io sono dell'idea che una funzionalità presente non deve essere rimossa, perchè ad esempio io sono uno degli utenti a cui piace usarla.

@elvarHex

Copy link
Copy Markdown
Contributor Author

infatti si aggiunge. Immagina in alto a destra dei pulsanti per scegliere se avere schermata "Audio" (come questa), "Video" e "Testo" per il karaoke

@fast4x

fast4x commented Jun 16, 2026

Copy link
Copy Markdown
Owner

C'è un aspetto che non mi convince:
capisco il pulsante delle lyrics, ma non quello del pulsante video.
Ti spiego:

  • immagina una coda di riproduzione che contiene audio e video, la selezione del tipo di output non può essere su richiesta ma deve avere una transizione automatica.
  • Sto suonando un audio, sto suonando un video, il player deve cambiare da solo, come avviene sul player di RiiPlay.

@elvarHex

Copy link
Copy Markdown
Contributor Author

io stavo pensando più a una cosa che si potrebbe fare direttamente su RiTune con il D-PAD:

  • Pulsante "Lyrics", clicco, la canzone in riproduzione non si ferma, è stesso ritune che recupera il testo e lo sincronizza con la canzone (come in RiPlay), e in questo caso RiPlay può anche non inviare altri dati oltre a quelli che già invia
  • Pulsante "Video", se c'è una canzone in riproduzione si ferma e riparte dal video (tramite ID, come faceva prima), oppure, se si vuole usare come lettore video da youtube come controllo remoto, si potrebbe creare una seconda modalità dell'utilizzo dell'app, quindi "RiPlay receiver" e "Video receiver" (è solo un idea) e quindi rimuovere il pulsante "Video" se già c'è una canzone in riproduzione con RiPlay.
  • Pulsante "Audio" (normale come questa PR)

è da ampliare, al omento è solo un idea.....

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.

2 participants