AirPlay.Cast (AirPlay v0.1.0)

Copy Markdown View Source

Play a PCM buffer to an AirPlay/RAOP receiver, end to end — a small session GenServer exposing play/3, stop/1, set_volume/2.

It owns the RTSP control connection (AirPlay.Session) and the RTP audio streamer (AirPlay.Player): establishes the handshake, streams the track, and tears the session down when the audio finishes or is stopped. Targets classic unencrypted-ALAC RAOP receivers (e.g. shairport-sync); genuine encrypted AirPlay 2 devices that require pairing aren't supported.

Volume is given 0–100 and mapped to AirPlay's dB range internally.

Summary

Functions

Returns a specification to start this module under a supervisor.

Set volume 0–100 (mapped to AirPlay dB). No-op if RTSP rejects it.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

play(host, pcm, opts \\ [])

@spec play(String.t(), binary(), keyword()) :: {:ok, pid()} | {:error, term()}

set_volume(pid, value)

@spec set_volume(pid(), non_neg_integer()) :: :ok

Set volume 0–100 (mapped to AirPlay dB). No-op if RTSP rejects it.

stop(pid)

@spec stop(pid()) :: :ok