Media
Show any file with the right viewer, and play MP3s and Icecast or Shoutcast live streams with a player your app controls. Everything runs on the browser's own media elements, with no media library.
The streaming player
StreamingAudio plays server-hosted MP3s and Icecast or Shoutcast live streams on the native audio element. It is fully controlled: nothing plays until the value says so, and the player sets it back when the browser blocks autoplay or a stream gives up.

Pick Riverwest Radio for a live stream, or a Thunder in the Garden track for a file you can seek. The value below is everything an app, or an agent, needs to read or set. This player and the site radio take turns: starting one pauses the other.
What ships today
Each claim is checkable in the components' docs.
Live streams and files
A live station has no seek bar; pause drops the connection and play reconnects at the live edge, so you never hear a stale buffer. A dropped stream reconnects with backoff, three attempts. A file keeps its position and gets elapsed, duration and a seek bar.
Only addresses it should play
StreamingAudio plays absolute http and https URLs and same-origin paths, and refuses every other scheme with an error state, so a station list from somewhere else cannot hand it a javascript: or data: address.
Lock-screen controls
The station and what is on air go to the Media Session, so the phone's lock screen and the keyboard's media keys play and pause it.
Channels and playlists
A channel is one track, a playlist or a live stream. ChannelGuide, ChannelPlayer, Playlist and MediaQueue share one value. Playlist reorders with Move up and Move down buttons, so the keyboard can do it, and removals an agent proposes wait for a person to accept them.
A viewer for every file
MediaViewer picks ImageViewer, VideoViewer, AudioViewer or PdfViewer from a file's type or its address, and shows a download card for anything else. ImageViewer fits, zooms with Ctrl or Command and the wheel, and pans.
Text too
fancy-code's FileViewer opens text in a read-only code editor with the language taken from the file name, and hands images, video, audio and PDFs to MediaViewer.

Choose a file. The image, the SVG, the PDF and the MP3 each get their own viewer from MediaViewer; the .tsx file opens in FileViewer's code editor.
Channels
A channel is a single track, a playlist of tracks, or a live stream from any streaming service. One value holds the whole player, so the guide, the player, the playlist and the queue stay in step, and an agent can drive them all through that same value.

Three channels: a single Thunder in the Garden track, a playlist of all three, and Riverwest Radio live. Reorder, remove or add tracks in the playlist, turn on shuffle and watch Up next follow. This player and the site radio take turns too.
Which streams play
Files, Icecast and Shoutcast play everywhere, on the browser's own media elements. HLS plays natively on Safari and iOS, and everywhere else once an app imports the opt-in hls.js adapter. YouTube, Vimeo and Twitch come in as embeds that load nothing until played, and an app can register its own providers.
How it fits
The viewers, the player and the channel components are react-fancy components; FileViewer in fancy-code builds on MediaViewer.
Install
npm install @particle-academy/react-fancynpm install @particle-academy/fancy-code
The packages
Add a player to your app
Install react-fancy, give StreamingAudio your stations and hold its value in state. Its page lists every prop, label and error kind.
