ExRTMP.Server.Handler behaviour (RTMP Server and Client v0.4.1)

View Source

Behaviour describing RTMP server handler.

Summary

Callbacks

Called when audio data is received.

Called when a client send a connect command message.

Called when a client send a deleteStream net stream command.

Called when onMetaData message is received.

Called when a client send a play net stream command.

Called when a client send a publish net stream command.

Called when video data is received.

Initializes the handler state.

Types

reason()

@type reason() :: any()

return()

@type return() :: {:ok, state()} | {:error, reason()}

state()

@type state() :: any()

timestamp()

@type timestamp() :: non_neg_integer()

Callbacks

handle_audio_data(timestamp, iodata, state)

(optional)
@callback handle_audio_data(timestamp(), iodata(), state()) :: state()

Called when audio data is received.

handle_connect(t, state)

(optional)
@callback handle_connect(ExRTMP.Message.Command.NetConnection.Connect.t(), state()) ::
  return()

Called when a client send a connect command message.

handle_delete_stream(state)

(optional)
@callback handle_delete_stream(state()) :: state() | :close

Called when a client send a deleteStream net stream command.

handle_metadata(metadata, state)

(optional)
@callback handle_metadata(metadata :: any(), state()) :: state()

Called when onMetaData message is received.

handle_play(t, state)

(optional)
@callback handle_play(ExRTMP.Message.Command.NetStream.Play.t(), state()) :: return()

Called when a client send a play net stream command.

handle_publish(stream_key, state)

(optional)
@callback handle_publish(stream_key :: String.t(), state()) :: return()

Called when a client send a publish net stream command.

handle_video_data(timestamp, iodata, state)

(optional)
@callback handle_video_data(timestamp(), iodata(), state()) :: state()

Called when video data is received.

init(opts)

(optional)
@callback init(opts :: any()) :: state()

Initializes the handler state.