fix(web): only pick SoundCloud tracks with app playback enabled for the Frutiger Aero soundtrack

This commit is contained in:
Martin Dvořák 2026-10-16 00:45:15 +02:00
commit 8f8a54cf18
5 changed files with 44 additions and 21 deletions

View file

@ -186,10 +186,15 @@ Themes: `web` = default frosted-glass website (sidebar + content, light/dark),
random track from the *Frutiger Aero* SoundCloud playlist (a hidden SoundCloud
iframe driven through their widget API: it picks a random index from `getSounds`
and re-randomises on every `PLAY` event so the set never plays in order; the chip
label is synced from `getCurrentSound`, not from what we asked for). That widget
API drives the iframe over `postMessage`, so every call is gated behind an
`alive()` check: React detaches the iframe *before* the effect cleanup runs, and
an unguarded `pause()` there throws `Cannot read properties of null (reading
label is synced from `getCurrentSound`, not from what we asked for). Two
SoundCloud quirks are handled there: entries from `getSounds` can arrive
not-yet-hydrated (no `title`/`user`) and are still perfectly playable, so the
random pick filters on `playable !== false` *only* — `playable: false` means the
uploader left "Enable app playback" off, and SoundCloud refuses to stream those
to a third-party app at all (picking one just leaves the player silent); and the
widget API drives the iframe over `postMessage`, so every call is gated behind
an `alive()` check — React detaches the iframe *before* the effect cleanup runs,
and an unguarded `pause()` there throws `Cannot read properties of null (reading
'postMessage')`, which unmounts the whole page. The two remaining feature panels (`.web-split`) stretch
to equal height and share a fixed `16 / 10` `.fw` window (the `FeatureWindow`
component) — decorative, **asset-free CSS mock-ups** rather than screenshots: