AirPlay.Rtsp (AirPlay v0.1.0)

Copy Markdown View Source

Minimal RTSP/1.0 client for the AirPlay/RAOP control plane.

RTSP looks like HTTP: METHOD url RTSP/1.0\r\n + headers + blank line + body. This module owns one TCP connection to the receiver and does synchronous request/response with an incrementing CSeq. Header set + behaviour matches a sender posing as iTunes/12.6 — see the protocol notes.

Summary

Functions

Open the RTSP TCP connection and seed the random per-session identifiers.

Send an RTSP request and read the response. method like "OPTIONS"; path defaults to the session URL (pass "*" for OPTIONS). headers is a keyword/list of {name, value}. Returns {:ok, status, resp_headers_map, body, state}.

Types

t()

@type t() :: %AirPlay.Rtsp{
  active_remote: term(),
  client_instance: term(),
  cseq: term(),
  dacp_id: term(),
  host: term(),
  port: term(),
  session_id: term(),
  sock: term(),
  url: term()
}

Functions

close(rtsp)

connect(host, port \\ 7000)

@spec connect(:inet.ip_address() | String.t(), :inet.port_number()) ::
  {:ok, t()} | {:error, term()}

Open the RTSP TCP connection and seed the random per-session identifiers.

request(state, method, headers \\ [], body \\ "", path \\ nil)

@spec request(t(), String.t(), keyword() | list(), binary(), String.t() | nil) ::
  {:ok, non_neg_integer(), map(), binary(), t()} | {:error, term()}

Send an RTSP request and read the response. method like "OPTIONS"; path defaults to the session URL (pass "*" for OPTIONS). headers is a keyword/list of {name, value}. Returns {:ok, status, resp_headers_map, body, state}.