Skip to content
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

Merged
merged 4 commits into from
Jul 24, 2023
Merged

Add hls playable field and notification #58

merged 4 commits into from
Jul 24, 2023

Conversation

Karolk99
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented Jul 20, 2023

Codecov Report

Merging #58 (85de9d8) into main (ea67d58) will increase coverage by 1.19%.
The diff coverage is 88.00%.

❗ Current head 85de9d8 differs from pull request most recent head 646d70e. Consider uploading reports for the commit 646d70e to get more accurate results

@@            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     
Impacted Files Coverage Δ
lib/jellyfish_web/server_socket.ex 85.29% <83.33%> (+7.35%) ⬆️
lib/jellyfish/room.ex 82.60% <87.50%> (+0.36%) ⬆️
lib/jellyfish/component.ex 100.00% <100.00%> (ø)
lib/jellyfish/component/hls.ex 100.00% <100.00%> (ø)
lib/jellyfish/component/rtsp.ex 100.00% <100.00%> (ø)
lib/jellyfish_web/api_spec/component.ex 100.00% <100.00%> (ø)
lib/jellyfish_web/controllers/component_json.ex 100.00% <100.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ea67d58...646d70e. Read the comment docs.

Comment on lines 187 to 195
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?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)

Comment on lines 328 to 342
@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
Copy link
Contributor

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?

Copy link
Member

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

@@ -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)
Copy link
Member

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?

Suggested change
metadata = get_metadata(type)
metadata = type.metadata()

Comment on lines 328 to 342
@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
Copy link
Member

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

Copy link
Member

@LVala LVala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Karolk99 Karolk99 merged commit ed2ea51 into main Jul 24, 2023
@Karolk99 Karolk99 deleted the hls-playable branch July 24, 2023 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants