Skip to content

Commit de1876b

Browse files
authored
Merge pull request #9 from membraneframework/bugfixes
Fix bugs and bump version to 0.1.2
2 parents ce94232 + e219bab commit de1876b

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The package can be installed by adding `ex_hls` to your list of dependencies in
1515
```elixir
1616
def deps do
1717
[
18-
{:ex_hls, "~> 0.1.1"}
18+
{:ex_hls, "~> 0.1.2"}
1919
]
2020
end
2121
```

lib/ex_hls/client/utils.ex

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ defmodule ExHLS.Client.Utils do
99
def download_or_read_file!(uri_or_path) do
1010
case URI.parse(uri_or_path).host do
1111
nil ->
12+
:ok = await_until_file_exists!(uri_or_path)
1213
Logger.debug("[ExHLS.Client] opening #{uri_or_path}")
1314
File.read!(uri_or_path)
1415

@@ -19,6 +20,21 @@ defmodule ExHLS.Client.Utils do
1920
end
2021
end
2122

23+
defp await_until_file_exists!(file_path) do
24+
cond do
25+
File.exists?(file_path) -> :ok
26+
file_exists_after_waiting?(file_path, 20) -> :ok
27+
file_exists_after_waiting?(file_path, 60) -> :ok
28+
file_exists_after_waiting?(file_path, 120) -> :ok
29+
true -> raise "File #{file_path} does not exist"
30+
end
31+
end
32+
33+
defp file_exists_after_waiting?(file_path, ms) do
34+
Process.sleep(ms)
35+
File.exists?(file_path)
36+
end
37+
2238
@spec stream_format_to_media_type(struct()) :: :audio | :video
2339
def stream_format_to_media_type(%H264{}), do: :video
2440
def stream_format_to_media_type(%AAC{}), do: :audio

lib/ex_hls/demuxing_engine/cmaf.ex

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ defmodule ExHLS.DemuxingEngine.CMAF do
6969
demuxing_engine = put_in(demuxing_engine.tracks_to_chunks[track_id], popped_qex)
7070
{:ok, chunk, demuxing_engine}
7171
else
72-
nil -> {:error, :unknown_track, demuxing_engine}
73-
{:empty, _qex} -> {:error, :empty_track_data, demuxing_engine}
72+
_other -> {:error, :empty_track_data, demuxing_engine}
7473
end
7574
end
7675

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmodule ExHLS.Mixfile do
22
use Mix.Project
33

4-
@version "0.1.1"
4+
@version "0.1.2"
55
@github_url "https://github.com/membraneframework/ex_hls"
66

77
def project do

0 commit comments

Comments
 (0)