View Source ExLibSRT.Client (ExLibSRT v0.2.0)

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

Link to this type

srt_client_disconnected()

View Source
@type srt_client_disconnected() :: :srt_client_started
@type srt_client_error() :: {:srt_client_error, reason :: String.t()}
@type srt_client_started() :: :srt_client_started
@type t() :: pid()

Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

read_socket_stats(agent)

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

Reads socket statistics.

Link to this function

send_data(payload, agent)

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

Sends data through the client connection.

Link to this function

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

View Source
@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.

Link to this function

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

View Source
@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.

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

Stops the active client connection.