Media module: linking YouTube Music and Spotify
The Media module works with any player Windows knows about (Spotify, YouTube Music, a browser tab, VLC…). Two players can also be linked to the hub. Then:
- the volume bar under the player controls the player’s own volume, not the Windows volume;
- the artwork comes from the player in full size.
A player that is not linked shows a small chip with an orange dot next to the volume bar. Tap it to see what to do. Until then, the bar controls the PC’s volume.
YouTube Music (desktop app by th-ch)
- In YouTube Music, open the Plugins menu and turn on API Server. Keep its default settings: port 26538, “Authorize at first request”.
- On the Edge, tap the YouTube Music chip, then Link.
- YouTube Music asks on the PC whether to allow
raidtech-edge-hub. Accept.
The hub keeps the access it was given in
%APPDATA%\RaidtechEdge\modules-data\media\youtube-music.json. Delete that file to unlink.
Volume: what the Edge shows
The Edge shows the number of YouTube Music’s volume bar and moves that bar. Two things make that less simple than it looks:
- YouTube Music’s exponential volume (a feature of YouTube Music itself, on for most accounts, not the “Exponential volume” plugin): its bar sets the player through a curve, bar 65 → player 34, and the API reports the player’s number. The hub turns it back into the bar’s with YouTube Music’s own formula (exact from 50 up, ±1 below, since the API rounds). It measures whether your account has the curve the first time you set the volume from the Edge.
- The Precise volume plugin saves the bar’s exact number: when it is on, the Edge shows that. It saves a move only when it is more than 4 away from the last saved value, so the Edge keeps a smaller change it made itself. It is also the only reliable source: YouTube Music’s API sometimes stops following the volume (it watches the first player of the session, which some tracks replace).
Precise volume does not know YouTube Music’s curve: once the bar moves (by hand or from the Edge), its mouse wheel and arrow keys start again from the player’s number (bar at 65, one notch down: 33). The Edge can only move the bar, so it cannot avoid this. Turning off Precise volume avoids it (YouTube Music’s own wheel then moves the bar 10 at a time), at the cost of the API’s less reliable number.
The Exponential volume plugin cubes the sound under every number, on top of YouTube Music’s own curve: bar 65 → player 34 → sound about 4 %. The numbers stay the same, so nothing in the API can undo it, and the sound no longer follows the bar.
So when Precise volume (with the curve) or Exponential volume is on, the Edge shows an orange dot on the volume bar; tapping it says which to turn off: in YouTube Music, Plugins menu, untick them, then restart YouTube Music.
The hub follows what YouTube Music has (the gear at the top right of the Media module shows the warning and the volume read).
Spotify
Spotify only lets an app change its volume through its Web API. That takes a free “developer app” of your own, made once.
- Go to https://developer.spotify.com/dashboard, sign in, then click Create app.
- Name and description: anything (e.g. “Raidtech Edge”).
- Redirect URI:
http://127.0.0.1:47821/m/media/spotify/callback, then click Add. - APIs used: Web API.
- Open the app’s Settings and copy its Client ID. You do not need the Client secret.
- On the PC, right-click the Raidtech Edge Hub icon in the taskbar, then Spotify settings….
Paste the Client ID between the quotes of
"clientId": ""and save. - On the Edge, tap the Spotify chip, then Link. Spotify’s sign-in page opens in the PC’s browser. Accept, then close the page.
Changing the volume needs Spotify Premium. That is a rule of Spotify’s API. Without Premium, the Edge says so when you move the bar. Use the volume mixer panel instead.
The tokens are kept in %APPDATA%\RaidtechEdge\modules-data\media\spotify-tokens.json. Delete that file to
unlink.
Queue and playlists
Once a player is linked, the queue button (a list with a play mark) under the player shows what comes next.
- YouTube Music: the whole queue. Tap a track to play it; tap × to remove it.
- Spotify: the track playing now and the next ones, read only (Spotify does not let other apps change its queue). The Playlists tab lists your playlists. Tap one to play it (Premium). Linked before version 0.7? Tap the Spotify chip and link it again: the playlists need a new permission.
YouTube Music’s API Server does not give your playlists.
Artwork
Windows only hands out small thumbnails. The hub looks for the full-size artwork of the current track:
- from the player itself, when it is linked (YouTube Music, Spotify);
- otherwise from a Deezer search with the title, the artist and the length. Only the same track is used.
The hub sends the title and the artist of each new track to Deezer. Videos and tracks that Deezer does not know keep Windows’ thumbnail.