View Source Membrane.RTSP.Server (Membrane RTSP v0.9.1)
Implementation of an RTSP server.
Usage
To use the RTSP server, you should start it and provide some configuration. To start a new server under a supervision tree:
children = [
{Membrane.RTSP.Server, [port: 8554, handler: MyRequestHandler]}
]
Supervisor.start_link(children, strategy: :one_for_one)Or start it directly by calling start_link/1 or start/1.
{:ok, server} = Membrane.RTSP.Server.start_link(config)For the available configuration options refer to start_link/1
Summary
Functions
Returns a specification to start this module under a supervisor.
Get the port number of the server.
Start an instance of the RTSP server.
Start and link an instance of the RTSP server.
Stops the RTSP server.
Types
@type server_config() :: [server_option()]
@type server_option() :: {:handler, module()} | {:handler_config, term()} | {:name, term()} | {:port, :inet.port_number()} | {:address, :inet.ip_address()} | {:udp_rtp_port, :inet.port_number()} | {:udp_rtcp_port, :inet.port_number()} | {:session_timeout, non_neg_integer()}
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec port_number(pid() | GenServer.name()) :: {:ok, :inet.port_number()} | {:error, any()}
Get the port number of the server.
If the server started with port number 0, the os will choose an available port to assign to the server.
@spec start(server_config()) :: GenServer.on_start()
Start an instance of the RTSP server.
Refer to start_link/1 for the available configuration.
@spec start_link(server_config()) :: GenServer.on_start()
Start and link an instance of the RTSP server.
Options
handler- An implementation of the behaviourMembrane.RTSP.Server.Handler. Refer to the module documentation for more details. This field is required.handler_config- Term that will be passed as an argument toinit/1callback of the handler. Defaults tonil.name- Used for name registration of the server. Defaults tonil.port- The port where the server will listen for client connections. Defaults to:554address- Specify the address where thetcpandudpsockets will be bound. Defaults to:any.udp_rtp_port- The port number of theUDPsocket that will be opened to sendRTPpackets.udp_rtcp_port- The port number of theUDPsocket that will be opened to sendRTCPpackets.session_timeout- if the server does not receive any request from the client within the specified timeframe (in seconds), the connection will be closed. Defaults to 60 seconds.
Server UDP supportBoth
udp_rtp_portandudp_rtcp_portmust be provided for the server to supportUDPtransport.
Stops the RTSP server.
Options
timeout- timeout of the server termination, passed toGenServer.stop/3.