-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Init functions don't have action handlers yet
- Loading branch information
Showing
2 changed files
with
45 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,43 @@ | ||
defmodule VyasaWeb.AudioPlayer do | ||
use VyasaWeb, :live_component | ||
use VyasaWeb, :live_component | ||
|
||
def mount(_, _, socket) do | ||
socket | ||
|> assign(playback: nil) | ||
end | ||
def mount(_, _, socket) do | ||
socket | ||
|> assign(playback: nil) | ||
end | ||
|
||
@impl true | ||
def render(assigns) do | ||
~H""" | ||
<div id="audio-player" phx-hook="AudioPlayer"> | ||
<audio></audio> | ||
</div> | ||
""" | ||
end | ||
@impl true | ||
def render(assigns) do | ||
~H""" | ||
<div id="audio-player" phx-hook="AudioPlayer"> | ||
<audio data-playback={Jason.encode!(@playback)}></audio> | ||
</div> | ||
""" | ||
end | ||
|
||
@impl true | ||
def update(%{ | ||
@impl true | ||
def update( | ||
%{ | ||
event: "media_bridge:update_audio_player" = event, | ||
playback: playback, | ||
} = _assigns, socket) do | ||
IO.inspect("handle update case in audio_player.ex with event = #{event}", label: "checkpoint") | ||
playback: playback | ||
} = _assigns, | ||
socket | ||
) do | ||
IO.inspect("handle update case in audio_player.ex with event = #{event}", label: "checkpoint") | ||
|
||
{ | ||
:ok, | ||
socket | ||
|> assign(playback: playback) | ||
} | ||
end | ||
|
||
{ | ||
:ok, socket | ||
|> assign(playback: playback) | ||
} | ||
end | ||
@impl true | ||
def update(assigns, socket) do | ||
IO.inspect(assigns, label: "what") | ||
|
||
@impl true | ||
def update(assigns, socket) do | ||
IO.inspect(assigns, label: "what") | ||
{:ok, socket | ||
|> assign(playback: nil) | ||
} | ||
end | ||
{:ok, | ||
socket | ||
|> assign(playback: nil)} | ||
end | ||
end |