AirPlay.Session (AirPlay v0.2.0)

Copy Markdown View Source

Drives the AirPlay/RAOP control handshake against a receiver.

establish/2 runs OPTIONS → ANNOUNCE(SDP) → SETUP → RECORD → SET_PARAMETER(volume) exactly as an AirPlay sender does, returning the negotiated server/control/timing ports needed to start the RTP audio stream. Targets classic RAOP with unencrypted ALAC (no rsaaeskey/aesiv), which every receiver supports.

Summary

Functions

Connect + handshake. opts[:volume] is dB (default -20). Returns {:ok, rtsp_state, ports} with the receiver's RTP ports, or {:error, reason}. The RTSP connection stays open (keepalive/teardown via the returned state).

Set playback volume in dB (~ -30 silent .. 0 max; -144 = mute).

Types

ports()

@type ports() :: %{
  server: integer(),
  control: integer(),
  timing: integer(),
  session: String.t()
}

Functions

establish(host, opts \\ [])

@spec establish(
  String.t(),
  keyword()
) :: {:ok, AirPlay.Rtsp.t(), ports()} | {:error, term()}

Connect + handshake. opts[:volume] is dB (default -20). Returns {:ok, rtsp_state, ports} with the receiver's RTP ports, or {:error, reason}. The RTSP connection stays open (keepalive/teardown via the returned state).

set_volume(s, db)

Set playback volume in dB (~ -30 silent .. 0 max; -144 = mute).

teardown(s)