mirror of
https://github.com/fly-apps/live_beats.git
synced 2024-12-20 06:06:29 +00:00
Set page title to song metadata when playing
This commit is contained in:
parent
fbd93bc02c
commit
7ef57e8813
1 changed files with 6 additions and 2 deletions
|
@ -276,13 +276,17 @@ defmodule LiveBeatsWeb.PlayerLive do
|
||||||
defp play_song(socket, %Song{} = song, elapsed) do
|
defp play_song(socket, %Song{} = song, elapsed) do
|
||||||
socket
|
socket
|
||||||
|> push_play(song, elapsed)
|
|> push_play(song, elapsed)
|
||||||
|> assign(song: song, playing: true)
|
|> assign(song: song, playing: true, page_title: song_title(song))
|
||||||
end
|
end
|
||||||
|
|
||||||
defp stop_song(socket) do
|
defp stop_song(socket) do
|
||||||
socket
|
socket
|
||||||
|> push_event("stop", %{})
|
|> push_event("stop", %{})
|
||||||
|> assign(song: nil, playing: false)
|
|> assign(song: nil, playing: false, page_title: "Listing Songs")
|
||||||
|
end
|
||||||
|
|
||||||
|
defp song_title(%{artist: artist, title: title}) do
|
||||||
|
"#{title} - #{artist} (Now Playing)"
|
||||||
end
|
end
|
||||||
|
|
||||||
defp play_current_song(socket) do
|
defp play_current_song(socket) do
|
||||||
|
|
Loading…
Reference in a new issue