Files
RedLintu16andClaude Opus 5.5 7caaccbd49 Rebuild the CrossSound Game Bar widget from scratch
A new UWP widget against CrossSound's local API (127.0.0.1:8963):
- Player with an interpolated clock, seek-on-release, play/pause, prev/next,
  like, shuffle, volume and mute
- Queue, Discover (history + shelves, refresh, play all, detail views) and
  Search (tracks, playlists, albums, artists)
- /events and /appearance/events loops with back-off and a visible
  connection status; signed-out states shown as such
- RedWhite styling with live theme from CrossSound's /appearance
- deploy.ps1 to build and register for the current user

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 19:58:36 -07:00

74 lines
3.6 KiB
Markdown

# CrossSound Game Bar widget
An Xbox Game Bar widget (UWP, C#) that remote-controls CrossSound through its local API on
`http://127.0.0.1:8963`. It never talks to SoundCloud itself. See `HANDOFF.md` for the API contract.
## What's in it
- **Player**: cover, title and artist, a clock that interpolates between `/events` frames, a seek bar
that sends one seek when you let go, prev / play-pause / next, like, shuffle, and volume with mute
(native CrossSound only).
- **Queue**: the current queue with the playing row marked. Tap a row to jump to it.
- **Discover**: Recently played plus the Discover shelves, with a refresh button. Each card has a play
button. Tapping a card opens its tracks, and you can play all or play from any row.
- **Search**: tracks, playlists, albums and artists. An artist opens their tracks.
- **Connection**: both event streams reconnect with back-off (1, 2, 5, 10 s). A status strip says
"connecting", or "not running" with a retry button. Signed out shows "Sign in to CrossSound".
- **Theme**: matches CrossSound's own look live through `/appearance/events`. Otherwise it uses the fixed
RedWhite palette, following Game Bar's light/dark setting. It also honors Game Bar's widget opacity.
## Layout
| Path | What |
|---|---|
| `App.xaml.cs` | Game Bar activation (`ms-gamebarwidget`, extension id `CrossSoundMedia`). A Start-menu launch opens the same page in a window for testing |
| `MediaWidget.xaml(.cs)` | The UI and all of its behavior |
| `Services/CrossSoundClient.cs` | HTTP clients, both event-stream loops, commands, artwork, library calls |
| `Services/ThemeManager.cs` | Recolors the shared `Rw*` brushes from `/appearance` or the fallback palettes |
| `Services/Json.cs` | Forgiving `Windows.Data.Json` readers (invariant culture, `long` ids) |
| `Models/` | `PlayerState` (snapshot) and `MediaCard` (Discover/Search rows) |
| `Controls/SeekBar.cs` | A square bar with separate events for moving and for letting go |
| `Styles/RedWhite.xaml` | Tokens, Raleway, and the button, tab, row and text-box templates |
## Build and deploy
Developer Mode must be on. `deploy.ps1` builds, installs the framework packages, and registers the app
for the current user, the same way Visual Studio's Deploy does.
PowerShell:
```powershell
powershell -ExecutionPolicy Bypass -File C:\Users\RedLintu16\Documents\WindowsC\XboxGameBar\deploy.ps1
```
Command Prompt:
```bat
powershell -ExecutionPolicy Bypass -File C:\Users\RedLintu16\Documents\WindowsC\XboxGameBar\deploy.ps1
```
Then open Game Bar (Win+G) > Widgets > CrossSound. Opening "CrossSound Widget" from the Start menu shows
the same UI in a normal window.
Signing uses a self-signed `CN=RedLintu16` certificate (`CrossSoundWidget_TemporaryKey.pfx`, not
committed). On a fresh clone, create one in Visual Studio (Package.appxmanifest > Packaging > Choose
Certificate > Create, publisher `CN=RedLintu16`) and update `PackageCertificateThumbprint` in the csproj.
Registering an unpacked layout, as `deploy.ps1` does, doesn't need the certificate to be trusted.
## Loopback
The package family name is `RedLintu16.CrossSoundWidget_jdapqa6743p5g`. It stays the same as long as the
Identity `Name` and the `CN=RedLintu16` publisher don't change, and the loopback exemption is tied to it.
If the widget can't connect but `curl.exe -s http://127.0.0.1:8963/ping` works, re-add the exemption
(PowerShell as Administrator):
```powershell
CheckNetIsolation LoopbackExempt -a -n="RedLintu16.CrossSoundWidget_jdapqa6743p5g"
```
Command Prompt as Administrator:
```bat
CheckNetIsolation LoopbackExempt -a -n=RedLintu16.CrossSoundWidget_jdapqa6743p5g
```