Set page title to song metadata when playing

This commit is contained in:
Michael Crumm 2022-02-03 09:43:02 -08:00
parent fbd93bc02c
commit 7ef57e8813
No known key found for this signature in database
GPG key ID: 4BE92DCED9E69BAA

View file

@ -276,13 +276,17 @@ defmodule LiveBeatsWeb.PlayerLive do
defp play_song(socket, %Song{} = song, elapsed) do
socket
|> push_play(song, elapsed)
|> assign(song: song, playing: true)
|> assign(song: song, playing: true, page_title: song_title(song))
end
defp stop_song(socket) do
socket
|> 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
defp play_current_song(socket) do