View Source Membrane.RTMP.Source (Membrane RTMP plugin v0.23.3)

Membrane Element for receiving an RTMP stream. Acts as a RTMP Server.

When initializing, the source sends socket_control_needed_t/0 notification, upon which it should be granted the control over the socket via :gen_tcp.controlling_process/2.

The Source allows for providing custom validator module, that verifies some of the RTMP messages. The module has to implement the Membrane.RTMP.MessageValidator behaviour. If the validation fails, the socket gets closed and the parent is notified with stream_validation_failed_t/0.

This implementation is limited to only AAC and H264 streams.

Element options

Passed via struct Membrane.RTMP.Source.t/0

  • socket

    :gen_tcp.socket() | :ssl.sslsocket()

    Required
    Socket on which the source will be receiving the RTMP or RTMPS stream. The socket must be already connected to the RTMP client and be in non-active mode (active set to false).

    In case of RTMPS the use_ssl? options must be set to true.

  • use_ssl?

    boolean()

    Default value: false
    Tells whether the passed socket is a regular TCP socket or SSL one.

  • validator

    Membrane.RTMP.MessageValidator.t()

    Default value: %Membrane.RTMP.MessageValidator.Default{}
    A Membrane.RTMP.MessageValidator implementation, used for validating the stream. By default allows every incoming stream.

Pads

:output

Accepted formats:

Membrane.RemoteStream
Direction::output
Availability::always
Flow control::manual
Demand unit:nil

Summary

Types

Notification sent when the RTMP Source element is initialized and it should be granted control over the socket using :gen_tcp.controlling_process/2.

Same as socket_control_needed_t/0 but for secured socket meant for RTMPS.

Notification sent when the validator denies incoming RTMP stream.

Notification sent when the validator approves given validation stage.

t()

Struct containing options for Membrane.RTMP.Source

Notification sent when the socket has been closed but no media data has flown through it.

Functions

Returns description of options available for this module

Types

Link to this type

socket_control_needed_t()

View Source
@type socket_control_needed_t() :: {:socket_control_needed, :gen_tcp.socket(), pid()}

Notification sent when the RTMP Source element is initialized and it should be granted control over the socket using :gen_tcp.controlling_process/2.

Link to this type

ssl_socket_control_needed_t()

View Source
@type ssl_socket_control_needed_t() ::
  {:ssl_socket_control_needed, :ssl.sslsocket(), pid()}

Same as socket_control_needed_t/0 but for secured socket meant for RTMPS.

Link to this type

stream_validation_failed_t()

View Source
@type stream_validation_failed_t() ::
  {:stream_validation_failed, validation_stage_t(), reason :: any()}

Notification sent when the validator denies incoming RTMP stream.

Link to this type

stream_validation_success_t()

View Source
@type stream_validation_success_t() ::
  {:stream_validation_success, validation_stage_t(), result :: any()}

Notification sent when the validator approves given validation stage.

@type t() :: %Membrane.RTMP.Source{
  socket: :gen_tcp.socket() | :ssl.sslsocket(),
  use_ssl?: boolean(),
  validator: Membrane.RTMP.MessageValidator.t()
}

Struct containing options for Membrane.RTMP.Source

Link to this type

unexpected_socket_closed_t()

View Source
@type unexpected_socket_closed_t() :: :unexpected_socket_closed

Notification sent when the socket has been closed but no media data has flown through it.

This notification is only sent when the :output pad never reaches :start_of_stream.

@type validation_stage_t() :: :publish | :release_stream | :set_data_frame

Functions

@spec options() :: keyword()

Returns description of options available for this module