gen_rtmp_server v0.1.1 GenRtmpServer behaviour

A behaviour module for implementing an RTMP server.

A GenRtmpServer abstracts out the the handling of RTMP connection handling and data so that modules that implement this behaviour can focus on the business logic of the actual RTMP events that are received and should be sent.

Each client that connects is placed in it’s own process.

Summary

Functions

Signals a specific RTMP server process to send an RTMP message to its client

Starts the generic RTMP server using the provided RTMP options

Callbacks

Called when audio or video data has been received on a published stream

Called when an code change is ocurring

Called when the client is requesting a connection to the specified application name

Called when any BEAM message is received that is not handleable by the generic RTMP server, and is thus being passed along to the module adopting this behaviour

Called when a new RTMP client connects

Called when a client publishing a stream has changed the metadata information for that stream

Called when the client no longer wants to play the stream from the specified application name and stream key combination

Called when the client is wanting to play a stream from the specified application name and stream key combination

Called when the client is no longer publishing to the specified application name and stream key

Called when a client wants to publish a stream to the specified application name and stream key combination

Types

adopter_state()
adopter_state() :: any
client_ip()
client_ip() :: String.t
command()
command() :: :ignore | :disconnect
forced_timestamp()
forced_timestamp() :: non_neg_integer | nil
outbound_data()
outbound_data() :: GenRtmpServer.AudioVideoData.t
request_result()
request_result() :: :accepted | {:rejected, command, String.t}
session_id()
session_id() :: String.t
stream_id()
stream_id() :: non_neg_integer

Functions

send_message(pid, outbound_data, stream_id, forced_timestamp \\ nil)
send_message(pid, outbound_data, stream_id, forced_timestamp) :: :ok

Signals a specific RTMP server process to send an RTMP message to its client

start_link(module, rtmp_options)
start_link(module, %GenRtmpServer.RtmpOptions{chunk_size: term, fms_version: term, log_mode: term, port: term}) :: Supervisor.on_start

Starts the generic RTMP server using the provided RTMP options

Callbacks

audio_video_data_received(arg0, adopter_state)

Called when audio or video data has been received on a published stream

code_change(any, adopter_state)
code_change(any, adopter_state) ::
  {:ok, adopter_state} |
  {:error, String.t}

Called when an code change is ocurring

connection_requested(arg0, adopter_state)

Called when the client is requesting a connection to the specified application name

handle_message(any, adopter_state)
handle_message(any, adopter_state) :: {:ok, adopter_state}

Called when any BEAM message is received that is not handleable by the generic RTMP server, and is thus being passed along to the module adopting this behaviour.

init(session_id, client_ip)

Called when a new RTMP client connects

metadata_received(arg0, adopter_state)

Called when a client publishing a stream has changed the metadata information for that stream.

play_finished(arg0, adopter_state)

Called when the client no longer wants to play the stream from the specified application name and stream key combination

play_requested(arg0, adopter_state)

Called when the client is wanting to play a stream from the specified application name and stream key combination

publish_finished(arg0, adopter_state)

Called when the client is no longer publishing to the specified application name and stream key

publish_requested(arg0, adopter_state)

Called when a client wants to publish a stream to the specified application name and stream key combination