rtmp v0.2.0 Rtmp.ClientSession.Handler

This module controls the process that processes the busines logic of a client in an RTMP connection.

When RTMP messages come in from the server, it either responds with response messages or raises events to be handled by the event receiver process. This allows for consumers to be flexible in how they utilize the RTMP client.

Summary

Functions

Passes an incoming RTMP message to the session handler

Notifies the session handler of new input or output byte totals

Sends audio or video data to the server over the specified stream key. This is ignored if we are not in an active publishing session for that stream key

Sends new metadata to the server over the specified stream key. This is ignored if we are not in an active publishing session on that stream key

Executes a request to send an RTMP connection request for the specified application name. The response will come as a Rtmp.ClientSession.Events.ConnectionResponseReceived event

Sends a request to play from the specified stream key. The response will come back as a Rtmp.ClientSession.Events.PlayResponseReceived event

Sends a request to the server that the client wishes to publish data on the specified stream key. The response will come as a Rtmp.ClientSession.Events.PublishResponseReceived response being raised

Specifies the process id and function to use to raise event notifications

Specifies the process id and function to send outbound RTMP messages

Starts a new client session handler process

Attempts to stop playback for the specified stream key. Does nothing if we do not have an active playback session on the specified stream key

Attempts to stop publishing on the specified stream key. This is ignored if we are not actively publishing on that stream key

Types

av_type()
av_type() :: :audio | :video
event_receiver_module()
event_receiver_module() :: module
event_receiver_process()
event_receiver_process() :: pid
protocol_handler_module()
protocol_handler_module() :: module
protocol_handler_process()
protocol_handler_process() :: pid
publish_type()
publish_type() :: :live
session_handler_process()
session_handler_process() :: pid

Functions

handle_rtmp_input(pid, detailed_message)

Passes an incoming RTMP message to the session handler

notify_byte_count(pid, atom, total)

Notifies the session handler of new input or output byte totals

publish_av_data(pid, stream_key, atom, timestamp, data)
publish_av_data(session_handler_process, Rtmp.stream_key, av_type, Rtmp.timestamp, binary) :: :ok

Sends audio or video data to the server over the specified stream key. This is ignored if we are not in an active publishing session for that stream key.

publish_metadata(pid, stream_key, stream_metadata)

Sends new metadata to the server over the specified stream key. This is ignored if we are not in an active publishing session on that stream key

request_connection(pid, app_name)
request_connection(session_handler_process, Rtmp.app_name) :: :ok

Executes a request to send an RTMP connection request for the specified application name. The response will come as a Rtmp.ClientSession.Events.ConnectionResponseReceived event.

request_playback(pid, stream_key)
request_playback(session_handler_process, Rtmp.stream_key) :: :ok

Sends a request to play from the specified stream key. The response will come back as a Rtmp.ClientSession.Events.PlayResponseReceived event.

request_publish(pid, stream_key, atom)

Sends a request to the server that the client wishes to publish data on the specified stream key. The response will come as a Rtmp.ClientSession.Events.PublishResponseReceived response being raised

set_event_handler(session_pid, event_pid, event_module)
set_event_handler(session_handler_process, event_receiver_process, event_receiver_module) ::
  :ok |
  :handler_already_set

Specifies the process id and function to use to raise event notifications.

It is expected that the module passed in implements the Rtmp.Behaviours.EventReceiver behaviour.

set_protocol_handler(session_pid, protocol_handler_pid, protocol_handler_module)
set_protocol_handler(session_handler_process, protocol_handler_process, protocol_handler_module) ::
  :ok |
  :handler_already_set

Specifies the process id and function to send outbound RTMP messages

It is expected that the module passed in implements the Rtmp.Behaviours.ProtocolHandler behaviour.

start_link(connection_id, configuration)

Starts a new client session handler process

stop_playback(pid, stream_key)
stop_playback(session_handler_process, Rtmp.stream_key) :: :ok

Attempts to stop playback for the specified stream key. Does nothing if we do not have an active playback session on the specified stream key

stop_publish(pid, stream_key)

Attempts to stop publishing on the specified stream key. This is ignored if we are not actively publishing on that stream key.