Radio Player
ProNewA live radio player: station list with logos, a live badge, what is on air and volume, in card, bar and mini layouts. Stream URLs come in through props.
Installation
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
Props
| Prop | Type | Default |
|---|---|---|
| stations* | RadioStation[]The stations to tune between. | — |
| layout | "card" | "bar" | "mini"`card` shows a large logo beside the controls, `bar` is a slim strip for the bottom of a page, and `mini` is a small card for a corner. | "card" |
| list | booleanShow the station list. Defaults to on when there is more than one station. | — |
| defaultListOpen | booleanWhether the station list starts open. | true |
| defaultIndex | numberStation tuned in at first. | 0 |
| defaultVolume | numberVolume at first, from 0 to 1. | 1 |
| liveLabel | stringText of the badge beside the station name. | "Live" |
| volume | booleanShow the volume control. | true |
| loading | booleanDraws a placeholder while the station list is being fetched. | false |
| disabled | booleanTurns every control off. | false |
| label | stringAccessible name of the player. | "Radio player" |
| onStationChange | (index: number, station: RadioStation) => voidCalled when another station is tuned in. | — |
| onPlayingChange | (playing: boolean) => voidCalled when sound starts or stops. | — |
| className | string | — |
Accessibility
- Stations are a list of native buttons; the tuned one carries aria-current and says whether it is playing, paused or off air, and Previous and Next station wrap around the list.
- The now-playing line is a polite live region, so a new song is read out when your metadata changes, and tuning to another station is announced.
- Pausing drops the stream and Play rejoins it live; a station that cannot be reached shows Off air and raises an alert with a Retry button.
- Under reduced motion the equalizer, the pulse in the live badge, the connecting spinner and the list slide stand still.