Membrane.RTC.Engine.Endpoint.File (Membrane RTC Engine File Endpoint v0.7.0)
View SourceAn 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, ifplayback_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 Enginefile_path
Path.t()
Required
Path to track filetrack_config
TrackConfig.t()
Required
Configuration of the track being publishedssrc
RTP.ssrc()
Default value:
nil
SSRC of RTP packetspayload_type
RTP.payload_type()
Required
Payload type of RTP packetsplayback_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 afterfile_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
- Reading ACC file:
Pads
:output
Accepted formats:
Membrane.RTP
Direction: | :output |
Availability: | :on_request |
Summary
Functions
Returns description of options available for this module
Types
@type encoding_t() :: String.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