Membrane.RTC.Engine.Endpoint.File (Membrane RTC Engine File Endpoint v0.7.0)

View Source

An Endpoint responsible for publishing data from a file. By default only supports OPUS encapsulated in Ogg container and raw H264 files. By providing proper value in option after_source_transformation you can read other formats, but the output from after_source_transformation have to be encoded in OPUS or H264. It can start publishing data in three different moments:

  • immediately after initialization, if playback_mode is set to :autoplay (default),
  • after calling playback_mode function with proper arguments, if playback_mode is set to :manual
  • after other endpoint subscribes on this endpoint track, if playback_mode is set to :wait_for_first_subscriber Currently, the File Endpoint only supports files that contain a single media track.

Bin options

Passed via struct Membrane.RTC.Engine.Endpoint.File.t/0

  • rtc_engine

    pid()

    Required
    Pid of parent Engine

  • file_path

    Path.t()

    Required
    Path to track file

  • track_config

    TrackConfig.t()

    Required
    Configuration of the track being published

  • ssrc

    RTP.ssrc()

    Default value: nil
    SSRC of RTP packets

  • payload_type

    RTP.payload_type()

    Required
    Payload type of RTP packets

  • playback_mode

    :autoplay | :manual | :wait_for_first_subscriber

    Default value: :autoplay
    Indicates, when the endpoint should start sending data:

    • autoplay - start immediately after initialization
    • manual - start on calling start_sending/2 function
    • wait_for_first_subscriber - start when the first endpoint subscribes on the track
  • autoend

    boolean()

    Default value: true
    Indicates, whether the endpoint should send :finished

                notification to engine immediately after processing all data. If set to `false`,
                the endpoint hast to be removed manually.
  • after_source_transformation

    (ChildrenSpec.builder() -> ChildrenSpec.builder())

    Default value: &Function.identity/1
    Additional pipeline transformation after file_source. The output stream must be encoded in OPUS or H264.

    Use this option when the provided file uses encoding other than Ogg encapsulated OPUS audio or H264 video.

    Example usage:

    • Reading ACC file: fn link_builder -> link_builder |> child(:decoder, Membrane.AAC.FDK.Decoder) |> child(:encoder, %Membrane.Opus.Encoder{input_stream_format: %Membrane.RawAudio{ channels: 1, sample_rate: 48_000, sample_format: :s16le }}) end

Pads

:output

Accepted formats:

Membrane.RTP
Direction::output
Availability::on_request

Summary

Functions

Returns description of options available for this module

Types

encoding_t()

@type encoding_t() :: String.t()

t()

@type t() :: %Membrane.RTC.Engine.Endpoint.File{
  after_source_transformation: (Membrane.ChildrenSpec.builder() ->
                                  Membrane.ChildrenSpec.builder()),
  autoend: boolean(),
  file_path: Path.t(),
  payload_type: Membrane.RTP.payload_type(),
  playback_mode: :autoplay | :manual | :wait_for_first_subscriber,
  rtc_engine: pid(),
  ssrc: Membrane.RTP.ssrc(),
  track_config: Membrane.RTC.Engine.Endpoint.File.TrackConfig.t()
}

Struct containing options for Membrane.RTC.Engine.Endpoint.File

Functions

options()

@spec options() :: keyword()

Returns description of options available for this module

start_sending(engine, endpoint_id)

@spec start_sending(pid(), any()) :: :ok