View Source Membrane.RTMPServer (Membrane RTMP plugin v0.24.0)

A simple RTMP server, which handles each new incoming connection. When a new client connects, the handle_new_client is invoked. New connections remain in an incomplete RTMP handshake state, until another process makes demand for their data. If no data is demanded within the client_timeout period, TCP socket is closed.

Options:

  • client_timeout: Time (ms) after which an unused client connection is automatically closed.
  • handle_new_client: An anonymous function called when a new client connects. It receives the client reference, app and stream_key, allowing custom processing, like sending the reference to another process. If it's not provided, default implementation is used: {:client_ref, client_ref, app, stream_key} message is sent to the process that invoked RTMPServer.start_link().

Summary

Types

t()

Defines options for the RTMP server.

Functions

Returns a specification to start this module under a supervisor.

Returns the port on which the server listens for connection.

Extracts ssl, port, app and stream_key from url.

Starts the RTMP server.

Types

@type server_identifier() :: pid() | atom()
@type t() :: [
  handler: Membrane.RTMPServer.ClientHandler.t(),
  port: :inet.port_number(),
  use_ssl?: boolean(),
  name: atom() | nil,
  handle_new_client:
    (client_ref :: pid(), app :: String.t(), stream_key :: String.t() -> any())
    | nil,
  client_timeout: Membrane.Time.t()
]

Defines options for the RTMP server.

Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

get_port(server_identifier)

View Source
@spec get_port(server_identifier()) :: :inet.port_number()

Returns the port on which the server listens for connection.

@spec parse_url(url :: String.t()) :: {boolean(), integer(), String.t(), String.t()}

Extracts ssl, port, app and stream_key from url.

Link to this function

start_link(server_options)

View Source
@spec start_link(server_options :: t()) :: GenServer.on_start()

Starts the RTMP server.