Track maps, logos and flags
Racelink ships pictures and maps your overlay can show without carrying its own copies: tracks, car logos, flags and the cover of the song that plays.
Ce guide n’existe pour l’instant qu’en anglais.
What there is
- Track maps
- The outline of a track with its turns, the same shape as the track topic. The demo session has a map too.
- Car logos
- A brand’s logo, 256 × 256, transparent.
- Flags
- A country’s flag, 4:3, by its two-letter code in lower case (de, gb, jp).
- Music artwork
- The cover of the track the computer plays, with the media permission.
They come from Racelink on the player’s computer and are allowed for every overlay without a permission. Racelink updates them with itself.
With the SDK
import { assetUrls, fetchTrack } from '@racelink/overlay';
flag.src = assetUrls.flag('de');
logo.src = assetUrls.carLogo('porsche');
// A map: the demo has its own; otherwise the track topic carries the current one.
const track = overlay.status === 'demo' ? await fetchTrack('demo') : overlay.telemetry.track;fetchTrack(id) returns null when Racelink is not running or has no map of that track, so keep something to show without it.
Which logo, which flag
Ask once for the index, assetUrls.index, and look things up in it rather than trying URLs. It lists the track ids, the brands with a logo, the flag codes, and tables that lead from a game’s ids to them:
{
"tracks": { "url": "/v2/assets/tracks/{id}.json", "demo": 42, "ids": [1, 2, 4] },
"carLogos": {
"url": "/v2/assets/car-logos/{brand}.png",
"brands": ["acura", "astonmartin", "audi"],
"iracingCars": { "3": "pontiac", "25": "lotus" }
},
"flags": {
"url": "/v2/assets/flags/{code}.svg",
"codes": ["ad", "ae", "de", "gb-eng"],
"iracingFlairs": { "16": "au", "31": "br" }
}
}carLogos.iracingCarsleads from an iRacing car id (drivers[i].carId) to its brand.flags.iracingFlairsleads from a driver’s flair (drivers[i].ext.iracing.flairId) to a flag.
The cover of the song
system.media.artworkUrl is the picture the player app shows for the current track. Only the current one is served, under a name that changes with it. You may draw it on a canvas and read its colours (<img crossorigin="anonymous">), for a panel that takes the cover’s tint. In the demo the artwork is built into the data, so it shows without Racelink.