Membrane.HTTPAdaptiveStream.Source (Membrane HTTP Adaptive Stream plugin v0.20.2)
View SourceA Membrane Source element that fetches and demuxes HLS streams.
It uses the ExHLS library to handle the HLS protocol.
It is recommended to plug Membrane.H264.Parser and Membrane.AAC.Parser
after this element to parse the video and audio streams respectively,
because the stream formats returned by this element can differ depending
on the type of the HLS stream (MPEG-TS or fMP4).
Element options
Passed via struct Membrane.HTTPAdaptiveStream.Source.t/0
urlString.t()Required
URL of the HLS playlist manifestbuffered_stream_timeMembrane.Time.t()Default value:
5 |> Membrane.Time.seconds()
Amount of time of stream, that will be buffered by Membrane.HTTPAdaptiveStream.Source.Defaults to 5 seconds.
Due to implementation details, the amount of the buffered stream might be slightly different than specified value.
variant_selection_policyvariant_selection_policy()Default value:
:highest_resolution
The policy used to select a variant from the list of available variants.The policy can be one of the predefined ones or a custom function that takes a map of variant IDs to their descriptions and returns the ID of the selected variant.
The predefined policies are:
:lowest_resolution- selects the variant with the lowest value of video width * height.:highest_resolution- selects the variant with the highest value of video width * height.:lowest_bandwidth- selects the variant with the lowest bandwidth.:highest_bandwidth- selects the variant with the highest bandwidth.
Defaults to
:highest_resolution.how_much_to_skipMembrane.Time.t()Default value:
0 |> Membrane.Time.days()
Specifies how much time should be discarded from each of the tracks.Please note that an actual discarded part of the stream might be at most of that length because it needs to be aligned with HLS segments distribution. The source will send an
Membrane.Event.Discontinuityevent with:durationfield representing duration of the discarded part of the stream.
Pads
:audio_output
Accepted formats:
AAC%RemoteStream{content_format: AAC}| Direction: | :output | 
| Availability: | :on_request | 
| Flow control: | :manual | 
| Demand unit: | :buffers | 
:video_output
Accepted formats:
H264%RemoteStream{content_format: H264}| Direction: | :output | 
| Availability: | :on_request | 
| Flow control: | :manual | 
| Demand unit: | :buffers | 
Summary
Types
Notification sent by Membrane.HTTPAdaptiveStream.Source to its parent when the element figures out what tracks are present in the HLS stream.
Struct containing options for Membrane.HTTPAdaptiveStream.Source
The policy used to select a variant from the list of available variants.
Types
@type new_tracks_notification() :: {:new_tracks, audio_output: Membrane.RemoteStream.t() | Membrane.AAC.t(), video_output: Membrane.RemoteStream.t() | Membrane.H264.t()}
Notification sent by Membrane.HTTPAdaptiveStream.Source to its parent when the element figures out what tracks are present in the HLS stream.
Contains pads that should be linked to the element and stream formats that will be sent via those pads.
If pads are linked before the element enters the :playing playback, the notification will
not be sent, but the pads will have to match the tracks in the HLS stream.
@type t() :: %Membrane.HTTPAdaptiveStream.Source{ buffered_stream_time: Membrane.Time.t(), how_much_to_skip: Membrane.Time.t(), url: String.t(), variant_selection_policy: variant_selection_policy() }
Struct containing options for Membrane.HTTPAdaptiveStream.Source
@type variant_selection_policy() :: :lowest_resolution | :highest_resolution | :lowest_bandwidth | :highest_bandwidth | (variants_map :: %{ required(integer()) => ExHLS.Client.variant_description() } -> variant_id :: integer())
The policy used to select a variant from the list of available variants.
The policy can be one of the predefined ones or a custom function that takes a map of variant IDs to their descriptions and returns the ID of the selected variant.
The predefined policies are:
:lowest_resolution- selects the variant with the lowest value of video width * height.:highest_resolution- selects the variant with the highest value of video width * height.:lowest_bandwidth- selects the variant with the lowest bandwidth.:highest_bandwidth- selects the variant with the highest bandwidth.
Functions
@spec options() :: keyword()
Returns description of options available for this module