AirPlay.V2.Setup (AirPlay v0.4.4)

Copy Markdown View Source

AirPlay 2 SETUP request helpers.

This module builds and sends the AP2 binary-plist control-plane requests. It is intentionally not a full player yet: HomePod-class devices also require PTP timing before encrypted RTP audio will render.

Summary

Functions

Send AP2 feedback/keepalive.

Send AP2 FLUSH with an RTP sequence and timestamp.

Send AP2 RECORD with the supplied RTP sequence and timestamp.

Send AP2 session SETUP. Defaults to PTP timing, which HomePods require.

Send AP2 SETPEERS with the peer IP address list.

Send AP2 SETRATEANCHORTIME with a prepared anchor plist map.

Build and send AP2 SETRATEANCHORTIME from a PTP clock sample.

Send AP2 volume as a text/parameters SET_PARAMETER body.

Send AP2 stream SETUP for 44.1 kHz ALAC RTP.

Functions

feedback(pairing)

@spec feedback(AirPlay.V2.Pairing.t()) ::
  {:ok, non_neg_integer(), map(), binary(), AirPlay.V2.Pairing.t()}
  | {:error, term()}

Send AP2 feedback/keepalive.

flush(pairing, seq, rtptime)

Send AP2 FLUSH with an RTP sequence and timestamp.

record(pairing, seq, rtptime)

@spec record(AirPlay.V2.Pairing.t(), non_neg_integer(), non_neg_integer()) ::
  {:ok, non_neg_integer(), map(), binary(), AirPlay.V2.Pairing.t()}
  | {:error, term()}

Send AP2 RECORD with the supplied RTP sequence and timestamp.

session(pairing, opts \\ [])

@spec session(
  AirPlay.V2.Pairing.t(),
  keyword()
) ::
  {:ok, non_neg_integer(), map(), binary(), AirPlay.V2.Pairing.t()}
  | {:error, term()}

Send AP2 session SETUP. Defaults to PTP timing, which HomePods require.

set_peers(pairing, local_ip)

@spec set_peers(AirPlay.V2.Pairing.t(), String.t() | [String.t()]) ::
  {:ok, non_neg_integer(), map(), binary(), AirPlay.V2.Pairing.t()}
  | {:error, term()}

Send AP2 SETPEERS with the peer IP address list.

set_rate_anchor_time(pairing, anchor)

@spec set_rate_anchor_time(AirPlay.V2.Pairing.t(), map()) ::
  {:ok, non_neg_integer(), map(), binary(), AirPlay.V2.Pairing.t()}
  | {:error, term()}

Send AP2 SETRATEANCHORTIME with a prepared anchor plist map.

set_rate_anchor_time(pairing, sample, rtp_time, opts \\ [])

@spec set_rate_anchor_time(
  AirPlay.V2.Pairing.t(),
  map(),
  non_neg_integer(),
  keyword()
) ::
  {:ok, non_neg_integer(), map(), binary(), AirPlay.V2.Pairing.t()}
  | {:error, term()}

Build and send AP2 SETRATEANCHORTIME from a PTP clock sample.

set_volume(pairing, volume)

@spec set_volume(AirPlay.V2.Pairing.t(), number()) ::
  {:ok, non_neg_integer(), map(), binary(), AirPlay.V2.Pairing.t()}
  | {:error, term()}

Send AP2 volume as a text/parameters SET_PARAMETER body.

stream(pairing, control_port, opts \\ [])

@spec stream(AirPlay.V2.Pairing.t(), :inet.port_number(), keyword()) ::
  {:ok, non_neg_integer(), map(), binary(), AirPlay.V2.Pairing.t()}
  | {:error, term()}

Send AP2 stream SETUP for 44.1 kHz ALAC RTP.