ExHLS.Client (ExHLS v0.1.5)
View SourceModule providing functionality to read and demux HLS streams. It allows reading chunks from the stream, choosing variants, and managing media playlists.
Summary
Functions
Starts the ExHLS client with the given URL.
Types
Functions
@spec generate_stream(client()) :: Enumerable.t(ExHLS.Chunk.t())
@spec get_skipped_segments_cumulative_duration_ms(client()) :: {:ok, non_neg_integer()} | no_return()
@spec get_variants(client()) :: %{optional(integer()) => variant_description()}
@spec new(String.t(), parent_process: pid(), how_much_to_skip_ms: non_neg_integer(), segment_format: :ts | :cmaf ) :: client()
Starts the ExHLS client with the given URL.
As options, you can pass :parent_process to specify the parent process that will be
allowed to read media chunks when the HLS stream is in the Live mode.
Parent process defaults to the process that created the client.
You can also pass :how_much_to_skip_ms option to specify how many milliseconds
of the beginning of the stream should be skipped. This option is only supported
when the HLS stream is in the VoD mode. Defaults to 0.
Apart from that you can also pass :segment_format to force treating HLS segments
as either MPEG-TS or CMAF container files. If you don't provide this option,
the client will treat HLS segments based on the extension in their name,
falling back MPEG-TS if the cannot recognize the extension.
Note that there is no guarantee that exactly the specified amount of time will be skipped.
The actual skipped duration may be slightly shorter, depending on the HLS segments durations.
To get the actual skipped duration, you can use get_skipped_segments_cumulative_duration_ms/1
function.