Ambient music and visuals, streamed live
ZenScape streams ambient music paired with cinematic visuals to help people focus, relax, and switch off. Listeners tune in to a live, continuous stream—much like radio—with the picture and sound moving together.
The challenge
Running a 24/7 live stream of synchronized music and 4K visuals raises a few hard problems:
- A live stream without a live encoder. A traditional live stream needs an encoder running around the clock. ZenScape needed a live stream built from files it already had, assembled into a continuous broadcast as it plays.
- Keeping everything in sync. Music, visual loops, the in-app player, and Google Cast devices all have to agree on what is playing and exactly where in the timeline it is.
- State at the edge. Playback state and listener data have to live close to users around the world, without a central database becoming the bottleneck.
What we built
We designed and built ZenScape's media delivery and the app that sits on top of it:
- An HLS live stitcher. A custom TypeScript and Rust engine that stitches audio and video segments from on-demand files into a continuous, sliding live window—keeping sequence numbers continuous and handling multiple bitrates for adaptive streaming.
- Edge infrastructure on Cloudflare. Cloudflare Workers, Durable Objects, and D1 hold the timeline for each stream in one place and record playback data close to listeners.
- A new client on TanStack Start. The app was rebuilt on TanStack Start, with custom hooks that keep the player locked to the live timeline and the music and visuals in step.
- HDR transcoding. A Python transcoding pipeline produces Dolby Vision, HDR10+, and HDR10 bitrate ladders, packaged with Shaka Packager.
The result
- No always-on encoder. The live stream is assembled from existing files, so there is no 24/7 encoding bill.
- Playlists served from the edge. Playlist generation and token checks run on Cloudflare Workers, close to every listener.
- Cast that stays in sync. Playback on Cast devices follows the same clock as the app, so switching screens doesn't break the flow.