-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add hls playable field and notification #58
Conversation
Codecov Report
@@ Coverage Diff @@
## main #58 +/- ##
==========================================
+ Coverage 84.80% 86.00% +1.19%
==========================================
Files 33 33
Lines 487 500 +13
==========================================
+ Hits 413 430 +17
+ Misses 74 70 -4
Continue to review full report in Codecov by Sentry.
|
correct_components? = | ||
components | ||
|> Enum.map(fn %Component{component: component} -> component end) | ||
|> Enum.all?(fn | ||
{:hls, %Hls{playable: false}} -> true | ||
{:rtsp, %Rtsp{}} -> true | ||
end) | ||
|
||
assert correct_components? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct_components? = | |
components | |
|> Enum.map(fn %Component{component: component} -> component end) | |
|> Enum.all?(fn | |
{:hls, %Hls{playable: false}} -> true | |
{:rtsp, %Rtsp{}} -> true | |
end) | |
assert correct_components? | |
assert true = | |
components | |
|> Enum.map(fn %Component{component: component} -> component end) | |
|> Enum.all?(fn | |
{:hls, %Hls{playable: false}} -> true | |
{:rtsp, %Rtsp{}} -> true | |
_other -> false | |
end) | |
lib/jellyfish/room.ex
Outdated
@impl true | ||
def handle_info({:playlist_playable, :video, _playlist_idl}, state) do | ||
endpoint_id = | ||
Enum.find_value(state.components, fn {id, %{type: type}} -> | ||
if type == Component.HLS, do: id | ||
end) | ||
|
||
Phoenix.PubSub.broadcast( | ||
Jellyfish.PubSub, | ||
"server_notification", | ||
{:hls_playable, state.id, endpoint_id} | ||
) | ||
|
||
{:noreply, state} | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we store this information somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be stored inside the HLS component
lib/jellyfish/component.ex
Outdated
@@ -44,14 +48,20 @@ defmodule Jellyfish.Component do | |||
@spec new(component(), map()) :: {:ok, t()} | {:error, term()} | |||
def new(type, options) do | |||
with {:ok, endpoint} <- type.config(options) do | |||
metadata = get_metadata(type) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we could move the logic of getting metadata to the modules in question?
metadata = get_metadata(type) | |
metadata = type.metadata() |
lib/jellyfish/room.ex
Outdated
@impl true | ||
def handle_info({:playlist_playable, :video, _playlist_idl}, state) do | ||
endpoint_id = | ||
Enum.find_value(state.components, fn {id, %{type: type}} -> | ||
if type == Component.HLS, do: id | ||
end) | ||
|
||
Phoenix.PubSub.broadcast( | ||
Jellyfish.PubSub, | ||
"server_notification", | ||
{:hls_playable, state.id, endpoint_id} | ||
) | ||
|
||
{:noreply, state} | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be stored inside the HLS component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
No description provided.