public void SyncLive(string groupName, CurrentPlayingViewModel track, float duration)
{
List<string> keys = new List<string>();
foreach (var key in lastListener.Where(p=>p.Value == groupName).Select(p=>p.Key))
{
Clients.Client(key).playLive(track, (int) duration);
keys.Add(key);
}
//Sending YouTube links after .playLive because it can take some time
var youTube = YouTube.Default;
var video = youTube.GetVideo("https://www.youtube.com/watch?v=" + track.TrackId);
var youtubeLink = video.Uri;
foreach (var key in keys)
{
Clients.Client(key).onPlaylinkGeneratedSync(youtubeLink, (int) duration);
lastListener.Remove(key);
}
}