Skip to content

Add AirPlay 2 playback #139

@darious

Description

@darious

Why

Sibling to #17 (Chromecast). AirPlay 2 covers what Chromecast doesn't: HomePod, Apple TV, and most premium speakers (Sonos, Bose, B&W, KEF, Sony, LG TVs). UPnP + Chromecast + AirPlay 2 covers ~95% of consumer playback hardware in the wild.

AirPlay 2 also has multi-room sync built in — useful in light of #137 (multi-room).

Requirements

Discovery

  • mDNS-based (_airplay._tcp.local / _raop._tcp.local for legacy audio).
  • Devices appear in the renderer list with AirPlay icon.

Control

  • Map existing renderer ops onto AirPlay: load, play, pause, stop, seek, volume, position.
  • Multi-speaker grouping via AirPlay 2's native group concept — let users group AirPlay 2 speakers and play to the group as a single renderer (overlaps with Multi-room synchronised playback #137 for AirPlay 2 specifically).

Media delivery

  • AirPlay 2 audio is typically streamed from the controller, not pulled from a URL — different from Cast/UPnP. Server pushes audio chunks over an authenticated HTTP/2 stream.
  • Implementation likely uses a Python AirPlay 2 sender library (pyatv is the most mature option, supports playback to AirPlay 2 receivers).
  • Format compatibility: AirPlay 2 expects ALAC or AAC at 44.1/16. Server may need to transcode FLAC/high-res for AirPlay targets.

Implementation sketch

Server (app/)

  • New app/services/airplay/ mirroring app/services/upnp/:
    • discovery.py — mDNS via zeroconf.
    • device.py — wraps pyatv for control + streaming.
  • Plug into the renderer abstraction introduced in Add Chromecast playback #17. Renderer registry now spans UPnP + Cast + AirPlay.
  • Transcoding pipeline if the source format isn't AirPlay-compatible.

Web + Android

  • Renderer picker already shows the merged list; AirPlay devices appear alongside the others. Distinct icon.

Open questions

  • Library choice: pyatv is the obvious pick but check it supports sender mode reliably on Linux. Some AirPlay 2 features are tricky outside Apple's stack.
  • Pairing / device authorisation: AirPlay 2 may require pairing per device. UX flow needed in renderer picker.
  • High-res / lossless: AirPlay 2 caps audio quality. Be explicit in the UI when the format is being downsampled.
  • Latency: AirPlay 2 has known latency — may need calibration if combined with Multi-room synchronised playback #137 multi-room across different protocols.

Out of scope

  • AirPlay video / screen mirroring — audio only.
  • AirPlay receiver mode (Jamarr being an AirPlay target) — separate feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions