LiveKit.EgressService (LiveKit v0.1.0)

Copy Markdown View Source

LiveKit Egress API — start and manage recordings and streams.

Every function is a thin wrapper around LiveKit.Twirp.call/6. It builds the protobuf request from keyword options, signs a short-lived service token with roomRecord permission, and returns {:ok, response} | {:error, %LiveKit.Error{}}.

iex> client = LiveKit.Client.new!(url: "http://localhost:7880", api_key: "k", api_secret: "s")
iex> {:error, error} = LiveKit.EgressService.stop_egress(client, [])
iex> error.type
:validation

For typed start methods, pass outputs as :file_outputs / :stream_outputs / :segment_outputs / :image_outputs, or as a single :output (one Proto output struct or a list) which is routed into those fields.

Summary

Functions

Lists egress. Optional filters: :room_name, :egress_id, :active.

Starts an egress using the unified StartEgress RPC.

Starts a participant egress. Requires :room_name and :identity.

Starts a room-composite egress. Requires :room_name.

Starts a track-composite egress. Requires :room_name.

Starts a single-track egress. Requires :room_name, :track_id, and :output.

Starts a web egress. Requires :url.

Stops an egress. Requires :egress_id.

Updates the layout of a running room-composite egress.

Adds or removes stream output URLs on a running egress. Requires :egress_id.

Functions

list_egress(client, opts \\ [])

@spec list_egress(
  LiveKit.Client.t(),
  keyword()
) :: {:ok, LiveKit.Proto.ListEgressResponse.t()} | {:error, LiveKit.Error.t()}

Lists egress. Optional filters: :room_name, :egress_id, :active.

start_egress(client, opts \\ [])

@spec start_egress(
  LiveKit.Client.t(),
  keyword()
) :: {:ok, LiveKit.Proto.EgressInfo.t()} | {:error, LiveKit.Error.t()}

Starts an egress using the unified StartEgress RPC.

Requires at least one of :template, :web, or :media. Optional: :room_name, :preset, :advanced, :outputs, :storage, :webhooks.

start_participant_egress(client, opts \\ [])

@spec start_participant_egress(
  LiveKit.Client.t(),
  keyword()
) :: {:ok, LiveKit.Proto.EgressInfo.t()} | {:error, LiveKit.Error.t()}

Starts a participant egress. Requires :room_name and :identity.

start_room_composite_egress(client, opts \\ [])

@spec start_room_composite_egress(
  LiveKit.Client.t(),
  keyword()
) :: {:ok, LiveKit.Proto.EgressInfo.t()} | {:error, LiveKit.Error.t()}

Starts a room-composite egress. Requires :room_name.

start_track_composite_egress(client, opts \\ [])

@spec start_track_composite_egress(
  LiveKit.Client.t(),
  keyword()
) :: {:ok, LiveKit.Proto.EgressInfo.t()} | {:error, LiveKit.Error.t()}

Starts a track-composite egress. Requires :room_name.

start_track_egress(client, opts \\ [])

@spec start_track_egress(
  LiveKit.Client.t(),
  keyword()
) :: {:ok, LiveKit.Proto.EgressInfo.t()} | {:error, LiveKit.Error.t()}

Starts a single-track egress. Requires :room_name, :track_id, and :output.

:output must be a %DirectFileOutput{} or a WebSocket URL string.

start_web_egress(client, opts \\ [])

@spec start_web_egress(
  LiveKit.Client.t(),
  keyword()
) :: {:ok, LiveKit.Proto.EgressInfo.t()} | {:error, LiveKit.Error.t()}

Starts a web egress. Requires :url.

stop_egress(client, opts \\ [])

@spec stop_egress(
  LiveKit.Client.t(),
  keyword()
) :: {:ok, LiveKit.Proto.EgressInfo.t()} | {:error, LiveKit.Error.t()}

Stops an egress. Requires :egress_id.

update_layout(client, opts \\ [])

@spec update_layout(
  LiveKit.Client.t(),
  keyword()
) :: {:ok, LiveKit.Proto.EgressInfo.t()} | {:error, LiveKit.Error.t()}

Updates the layout of a running room-composite egress.

Requires :egress_id and :layout.

update_stream(client, opts \\ [])

@spec update_stream(
  LiveKit.Client.t(),
  keyword()
) :: {:ok, LiveKit.Proto.EgressInfo.t()} | {:error, LiveKit.Error.t()}

Adds or removes stream output URLs on a running egress. Requires :egress_id.