Radio puff

Compact now-playing teaser for Radio Aftonbladet with a play button and a ticker for what's next.

@schibsted/ab-radio-puffv0.0.7

Preview

Light
JUST NU

Lyssna på Radio Aftonbladet

Alltid det senaste

Dark
JUST NU

Lyssna på Radio Aftonbladet

Alltid det senaste

Drag the bottom-right corner of a preview to test narrower widths.

Install

npm install @schibsted/ab-radio-puff

RadioPuff

Radio puff widget. The frontend is written in Svelte (src/RadioPuff.svelte) and wrapped in an Astro component (src/RadioPuff.astro) that hydrates it.

Usage

The now-playing data is read from S3, so you need to be logged in to AWS locally to get the real data:

aws sso login --profile default

The consuming Astro project needs the @astrojs/svelte integration.

---
import RadioPuff from '@schibsted/ab-radio-puff';
---

<RadioPuff
	title="Morgonshow med Hjertén och Letic"
	nextShow="Besök av Alex och Sigge i studion"
	track="Midnight Sun med Zara Larsson"
	next="Survivor med Destinys Child"
/>
Prop Description
title Program on air now, shown in the header.
nextShow Upcoming program, shown as “Snart: …” under the title.
track Currently playing track, shown in the ticker (no label).
next Upcoming track, shown in the ticker labelled “Nästa:”.
assetId SVP asset id of the live stream, passed to <audio-play-button>. Defaults to 396373.

Playback

The puff does not play audio itself. Its play button is an <audio-play-button> custom element that the host page must define (front-pages does this with registerAll() from @lumon/audio-utilities). The element starts and stops the host’s player with { assetId, title, provider: 'ab', vendor: 'ab', isLive: true } and reports the player state back, so the play/pause icon stays in sync when playback is controlled elsewhere on the page. Without the element defined, the button renders but does nothing.

Fonts are loaded from the Aftonbladet CDN. Colours are defined in src/theme.css using the same --c-* names and values as cdn.aftonbladet.se/dark/variables.css, and the widget switches to dark mode when data-color-scheme="dark" is set on an ancestor element — the same attribute @schibsted/dark-mode’s initializeDarkMode() sets on document.documentElement in front-pages.