diff --git a/lib/live_beats_web/live/player_live.ex b/lib/live_beats_web/live/player_live.ex index 9226c56..26bc162 100644 --- a/lib/live_beats_web/live/player_live.ex +++ b/lib/live_beats_web/live/player_live.ex @@ -155,6 +155,10 @@ defmodule LiveBeatsWeb.PlayerLive do if profile && connected?(socket) do current_user = Accounts.update_active_profile(current_user, profile.user_id) + #untrack last profile the user was listening + if socket.assigns.profile do + LiveBeats.PresenceClient.untrack(socket.assigns.profile, current_user.id) + end LiveBeats.PresenceClient.track(profile, current_user.id) send(self(), :play_current)