# yasukoisreal/ytmusicwp architecture

> Architecture diagram of the GitHub repository yasukoisreal/ytmusicwp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yasukoisreal/ytmusicwp
- Repository: https://github.com/yasukoisreal/ytmusicwp
- Video tour (about a minute): https://gitdiagram.com/yasukoisreal/ytmusicwp/video

## Overview

YTMusicWP is a native YouTube Music client for legacy Windows phones. Users discover music through home, search, and library views, then play it through a background audio task; the app also supports synced lyrics, downloads, accounts, social listening, and device-local features. The graph combines documented product capabilities with relationships visible in the supplied source index and excerpts. Several feature implementations were not sampled, so their links are documented README relationships rather than claims of inspected call paths.

Main entry points: [`YTMusicWP/Pages/MainPage.NowPlaying.cs`](https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Pages/MainPage.NowPlaying.cs) (Now playing), [`AudioPlayerTask/AudioTask.cs`](https://github.com/yasukoisreal/ytmusicwp/blob/main/AudioPlayerTask/AudioTask.cs) (Background audio task), [`YTMusicWP/Services/InnerTubeClient.cs`](https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Services/InnerTubeClient.cs) (YouTube Music API), [`YTMusicWP/Pages/MainPage.Search.cs`](https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Pages/MainPage.Search.cs) (Search and browse)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["App experience"]
  node_app["App shell<br/>[App.xaml.cs]"]
  node_discovery["Home discovery<br/>[MainPage.Home.cs]"]
  node_search["Search and browse<br/>[MainPage.Search.cs]"]
  node_library["Library and playlists"]
  node_nowplaying["Now playing"]
end

subgraph group_music["Music services"]
  node_api["YouTube Music API<br/>[InnerTubeClient.cs]"]
  node_track["Track model<br/>[YouTubeTrack.cs]"]
  node_account["Account and login<br/>[MainPage.Auth.cs]"]
  node_lyrics["Synced lyrics<br/>[MainPage.Lyrics.cs]"]
  node_youtube(("YouTube Music"))
end

subgraph group_playback["Playback and audio"]
  node_audio["Background audio task<br/>[AudioTask.cs]"]
  node_sabr["SABR streaming"]
  node_live["Live stream source"]
  node_localserver["Local media server"]
  node_download["Offline downloads"]
end

subgraph group_local["Local features"]
  node_storage[("Local database<br/>[DatabaseHelper.cs]")]
  node_tiles["Live Tiles<br/>[TileService.cs]"]
  node_stats["Listening statistics"]
end

subgraph group_social["Connected features"]
  node_lastfm["Last.fm scrobbling<br/>[LastFmClient.cs]"]
  node_together["Listen Together manager"]
  node_togetherclient["Room WebSocket"]
  node_roomservice(("Listen Together service"))
end

node_user(("Listener"))

node_user -->|"opens"| node_app
node_app -->|"navigates to"| node_discovery
node_user -->|"searches"| node_search
node_user -->|"manages music"| node_library
node_user -->|"controls playback"| node_nowplaying
node_discovery -.->|"loads content"| node_api
node_search -->|"queries"| node_api
node_library -.->|"syncs playlists"| node_api
node_api -->|"requests catalog"| node_youtube
node_account -->|"authenticates"| node_api
node_search -->|"presents results"| node_track
node_library -->|"persists library"| node_storage
node_nowplaying -.->|"controls task"| node_audio
node_audio -->|"plays SABR"| node_sabr
node_audio -.->|"streams live audio"| node_live
node_audio -.->|"serves local media"| node_localserver
node_nowplaying -->|"shows synced lyrics"| node_lyrics
node_lyrics -->|"fetches subtitles"| node_youtube
node_audio -.->|"supports offline playback"| node_download
node_nowplaying -.->|"updates tile"| node_tiles
node_nowplaying -.->|"records listening"| node_stats
node_stats -.->|"scrobbles optionally"| node_lastfm
node_user -->|"joins room"| node_together
node_together -->|"dispatches messages"| node_togetherclient
node_togetherclient -->|"exchanges events"| node_roomservice

click node_app "https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/App.xaml.cs"
click node_discovery "https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Pages/MainPage.Home.cs"
click node_search "https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Pages/MainPage.Search.cs"
click node_library "https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Pages/MainPage.Library.cs"
click node_nowplaying "https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Pages/MainPage.NowPlaying.cs"
click node_api "https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Services/InnerTubeClient.cs"
click node_track "https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Models/YouTubeTrack.cs"
click node_account "https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Pages/MainPage.Auth.cs"
click node_audio "https://github.com/yasukoisreal/ytmusicwp/blob/main/AudioPlayerTask/AudioTask.cs"
click node_sabr "https://github.com/yasukoisreal/ytmusicwp/blob/main/AudioPlayerTask/SabrMediaStreamSource.cs"
click node_live "https://github.com/yasukoisreal/ytmusicwp/blob/main/AudioPlayerTask/LiveMediaStreamSource.cs"
click node_localserver "https://github.com/yasukoisreal/ytmusicwp/blob/main/AudioPlayerTask/LocalMusicServer.cs"
click node_lyrics "https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Pages/MainPage.Lyrics.cs"
click node_download "https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Pages/MainPage.Playback.cs"
click node_storage "https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Services/DatabaseHelper.cs"
click node_tiles "https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Services/TileService.cs"
click node_stats "https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Services/ListeningStatsCalculator.cs"
click node_lastfm "https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Services/LastFmClient.cs"
click node_together "https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Services/ListenTogether/ListenTogetherManager.cs"
click node_togetherclient "https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Services/ListenTogether/ListenTogetherClient.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_discovery,node_search,node_library,node_nowplaying toneBlue
class node_api,node_track,node_account,node_lyrics,node_youtube toneAmber
class node_audio,node_sabr,node_live,node_localserver,node_download toneMint
class node_storage,node_tiles,node_stats toneRose
class node_lastfm,node_together,node_togetherclient,node_roomservice,node_user toneIndigo
```

## Components

### App experience

- [App shell](https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/App.xaml.cs): `YTMusicWP/App.xaml.cs`
- [Home discovery](https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Pages/MainPage.Home.cs): `YTMusicWP/Pages/MainPage.Home.cs`
- [Search and browse](https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Pages/MainPage.Search.cs): `YTMusicWP/Pages/MainPage.Search.cs`
- [Library and playlists](https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Pages/MainPage.Library.cs): `YTMusicWP/Pages/MainPage.Library.cs`
- [Now playing](https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Pages/MainPage.NowPlaying.cs): `YTMusicWP/Pages/MainPage.NowPlaying.cs`

### Music services

- [YouTube Music API](https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Services/InnerTubeClient.cs): `YTMusicWP/Services/InnerTubeClient.cs`
- [Track model](https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Models/YouTubeTrack.cs): `YTMusicWP/Models/YouTubeTrack.cs`
- [Account and login](https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Pages/MainPage.Auth.cs): `YTMusicWP/Pages/MainPage.Auth.cs`
- [Synced lyrics](https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Pages/MainPage.Lyrics.cs): `YTMusicWP/Pages/MainPage.Lyrics.cs`
- **YouTube Music**

### Playback and audio

- [Background audio task](https://github.com/yasukoisreal/ytmusicwp/blob/main/AudioPlayerTask/AudioTask.cs): `AudioPlayerTask/AudioTask.cs`
- [SABR streaming](https://github.com/yasukoisreal/ytmusicwp/blob/main/AudioPlayerTask/SabrMediaStreamSource.cs): `AudioPlayerTask/SabrMediaStreamSource.cs`
- [Live stream source](https://github.com/yasukoisreal/ytmusicwp/blob/main/AudioPlayerTask/LiveMediaStreamSource.cs): `AudioPlayerTask/LiveMediaStreamSource.cs`
- [Local media server](https://github.com/yasukoisreal/ytmusicwp/blob/main/AudioPlayerTask/LocalMusicServer.cs): `AudioPlayerTask/LocalMusicServer.cs`
- [Offline downloads](https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Pages/MainPage.Playback.cs): `YTMusicWP/Pages/MainPage.Playback.cs`

### Local features

- [Local database](https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Services/DatabaseHelper.cs): `YTMusicWP/Services/DatabaseHelper.cs`
- [Live Tiles](https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Services/TileService.cs): `YTMusicWP/Services/TileService.cs`
- [Listening statistics](https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Services/ListeningStatsCalculator.cs): `YTMusicWP/Services/ListeningStatsCalculator.cs`

### Connected features

- [Last.fm scrobbling](https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Services/LastFmClient.cs): `YTMusicWP/Services/LastFmClient.cs`
- [Listen Together manager](https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Services/ListenTogether/ListenTogetherManager.cs): `YTMusicWP/Services/ListenTogether/ListenTogetherManager.cs`
- [Room WebSocket](https://github.com/yasukoisreal/ytmusicwp/blob/main/YTMusicWP/Services/ListenTogether/ListenTogetherClient.cs): `YTMusicWP/Services/ListenTogether/ListenTogetherClient.cs`
- **Listen Together service**

### Other components

- **Listener**

## Connections

- Listener → App shell: opens (evidence: `YTMusicWP/App.xaml.cs`)
- App shell → Home discovery: navigates to (evidence: `YTMusicWP/App.xaml.cs`)
- Listener → Search and browse: searches (evidence: `README.md`)
- Listener → Library and playlists: manages music (evidence: `README.md`)
- Listener → Now playing: controls playback (evidence: `README.md`)
- Home discovery → YouTube Music API: loads content
- Search and browse → YouTube Music API: queries (evidence: `YTMusicWP/Pages/MainPage.Search.cs`)
- Library and playlists → YouTube Music API: syncs playlists (evidence: `README.md`)
- YouTube Music API → YouTube Music: requests catalog (evidence: `YTMusicWP/Services/InnerTubeClient.cs`)
- Account and login → YouTube Music API: authenticates (evidence: `YTMusicWP/Pages/MainPage.Auth.cs`)
- Search and browse → Track model: presents results (evidence: `YTMusicWP/Pages/MainPage.Search.cs`)
- Library and playlists → Local database: persists library
- Now playing → Background audio task: controls task (evidence: `README.md`)
- Background audio task → SABR streaming: plays SABR (evidence: `AudioPlayerTask/AudioTask.cs`)
- Background audio task → Live stream source: streams live audio (evidence: `AudioPlayerTask/AudioTask.cs`)
- Background audio task → Local media server: serves local media (evidence: `AudioPlayerTask/AudioTask.cs`)
- Now playing → Synced lyrics: shows synced lyrics (evidence: `README.md`)
- Synced lyrics → YouTube Music: fetches subtitles (evidence: `README.md`)
- Background audio task → Offline downloads: supports offline playback (evidence: `README.md`)
- Now playing → Live Tiles: updates tile (evidence: `README.md`)
- Now playing → Listening statistics: records listening (evidence: `README.md`)
- Listening statistics → Last.fm scrobbling: scrobbles optionally (evidence: `README.md`)
- Listener → Listen Together manager: joins room (evidence: `README.md`)
- Listen Together manager → Room WebSocket: dispatches messages (evidence: `YTMusicWP/Services/ListenTogether/ListenTogetherManager.cs`)
- Room WebSocket → Listen Together service: exchanges events (evidence: `YTMusicWP/Services/ListenTogether/ListenTogetherClient.cs`)
