How to Chromecast from a Mac to a TV

A Mac has no Cast button. This video shows a native player, written in Osprey, that finds every Chromecast and Google TV on the network and plays a local MP3 on one with full controls.

How to Chromecast from a Mac to a TV (1:36). Captions are on; choose a chapter to jump to it.

The full write-up, with the code and its limits, is How to Chromecast from a Mac to a TV.

Osprey is actively evolving.

Transcript

  1. A Mac has no Cast button. Chrome casts a browser tab, but it won't play an MP3 from your Mac on the TV with proper controls. This native player does.
  2. It finds every Chromecast and Google TV on your network by name. Open an MP3, pick a TV, and press play.
  3. Pause, seek, volume and speed all work, and the controls show what the TV reports. With ffmpeg installed, the TV shows a moving spectrum of the music.
  4. A Chromecast never receives your file directly.
  5. The player finds TVs, opens a TLS session, and launches the default media receiver. Then it serves the file over HTTP from your Mac, and tells the TV where to fetch it.
  6. Discovery uses the dns-sd tool that macOS already ships. Nothing extra to install.
  7. The whole interface is one data file of state machines and skins. The only code is this adapter, which answers each request with the Chromecast package.
  8. An unknown request becomes an error on screen, never a silent no-op.
  9. Every byte goes through one algebraic effect. In the tests, a handler plays the TV, so four whole journeys run with no window and no network.
  10. All four pass.
  11. What to know first. It plays MP3 files only, it runs on macOS, and it does not verify the TV's certificate.
  12. Build Osprey, then open the player. Osprey is actively evolving. Try it on your projects, and tell us what breaks.