ExLibSRT.Client (ExLibSRT v0.2.1)

Copy Markdown View Source

Implementation of the SRT client.

API

The client API consinsts of the following functions:

  • start/3 - starts a client connection to the server
  • start/4 - starts a client connection to the server with password authentication
  • start_link/3 - starts a client connection to the server and links to current process
  • start_link/4 - starts a client connection to the server with password authentication and links to current process
  • start_link/5 - starts a client connection to the server with password authentication, sets SRT latency and links to current process
  • stop/1 - stops the client connection
  • send_data/2 - sends a packet through the client connection

Password Authentication

When connecting to a server that requires password authentication:

A process starting the client will also receive the following notifications:

Summary

Functions

Returns a specification to start this module under a supervisor.

Reads socket statistics.

Sends data through the client connection.

Starts a new SRT connection to the target address and port outside the supervision tree.

Starts a new SRT connection to the target address and port and links to the current process.

Stops the active client connection.

Types

srt_client_disconnected()

@type srt_client_disconnected() :: :srt_client_started

srt_client_error()

@type srt_client_error() :: {:srt_client_error, reason :: String.t()}

srt_client_started()

@type srt_client_started() :: :srt_client_started

t()

@type t() :: pid()

Functions

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

read_socket_stats(agent)

@spec read_socket_stats(t()) ::
  {:ok, ExLibSRT.SocketStats.t()} | {:error, reason :: String.t()}

Reads socket statistics.

send_data(payload, agent)

@spec send_data(binary(), t()) ::
  :ok | {:error, :payload_too_large | (reason :: String.t())}

Sends data through the client connection.

start(address, port, stream_id, password \\ "")

@spec start(
  address :: String.t(),
  port :: non_neg_integer(),
  stream_id :: String.t(),
  password :: String.t()
) :: {:ok, t()} | {:error, reason :: String.t(), error_code :: integer()}

Starts a new SRT connection to the target address and port outside the supervision tree.

Password Authentication

If a password is provided, it must be between 10 and 79 characters long according to SRT specification. An empty string means no password authentication will be used.

start_link(address, port, stream_id, password \\ "", latency_ms \\ -1)

@spec start_link(
  address :: String.t(),
  port :: non_neg_integer(),
  stream_id :: String.t(),
  password :: String.t(),
  latency_ms :: integer()
) :: {:ok, t()} | {:error, reason :: String.t(), error_code :: integer()}

Starts a new SRT connection to the target address and port and links to the current process.

Password Authentication

If a password is provided, it must be between 10 and 79 characters long according to SRT specification. An empty string means no password authentication will be used.

stop(agent)

@spec stop(t()) :: :ok

Stops the active client connection.