Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The package can be installed by adding `ex_hls` to your list of dependencies in
```elixir
def deps do
[
{:ex_hls, "~> 0.1.1"}
{:ex_hls, "~> 0.1.2"}
]
end
```
Expand Down
16 changes: 16 additions & 0 deletions lib/ex_hls/client/utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ defmodule ExHLS.Client.Utils do
def download_or_read_file!(uri_or_path) do
case URI.parse(uri_or_path).host do
nil ->
:ok = await_until_file_exists!(uri_or_path)
Logger.debug("[ExHLS.Client] opening #{uri_or_path}")
File.read!(uri_or_path)

Expand All @@ -19,6 +20,21 @@ defmodule ExHLS.Client.Utils do
end
end

defp await_until_file_exists!(file_path) do
cond do
File.exists?(file_path) -> :ok
file_exists_after_waiting?(file_path, 20) -> :ok
file_exists_after_waiting?(file_path, 60) -> :ok
file_exists_after_waiting?(file_path, 120) -> :ok
true -> raise "File #{file_path} does not exist"
end
end

defp file_exists_after_waiting?(file_path, ms) do
Process.sleep(ms)
File.exists?(file_path)
end

@spec stream_format_to_media_type(struct()) :: :audio | :video
def stream_format_to_media_type(%H264{}), do: :video
def stream_format_to_media_type(%AAC{}), do: :audio
Expand Down
3 changes: 1 addition & 2 deletions lib/ex_hls/demuxing_engine/cmaf.ex
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ defmodule ExHLS.DemuxingEngine.CMAF do
demuxing_engine = put_in(demuxing_engine.tracks_to_chunks[track_id], popped_qex)
{:ok, chunk, demuxing_engine}
else
nil -> {:error, :unknown_track, demuxing_engine}
{:empty, _qex} -> {:error, :empty_track_data, demuxing_engine}
_other -> {:error, :empty_track_data, demuxing_engine}
end
end

Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule ExHLS.Mixfile do
use Mix.Project

@version "0.1.1"
@version "0.1.2"
@github_url "https://github.com/membraneframework/ex_hls"

def project do
Expand Down