public static void PlayNextSong() { if (QueueSongNames.Count > 0) { PlaySongImmediately(QueueSongNames.Dequeue()); } }
public static void QueueSong(string songName, QueueType queueType = QueueType.WaitForCurrent) { QueueSongNames.Enqueue(songName); if (queueType == QueueType.PlayImmediately) { PlayNextSong(); } }
public static void Update() { if (MediaPlayer.State == MediaState.Stopped) { // If we have songs still queued then dequeue the next song name if (QueueSongNames.Count > 0) { CurrentSong = Songs[QueueSongNames.Dequeue()]; MediaPlayer.Play(CurrentSong); } // Else just keep playing the song last played else if (CurrentSong != null) { MediaPlayer.Play(CurrentSong); } } }
public static void QueueSongs(List <string> songs, QueueType queueType = QueueType.WaitForCurrent) { // If we are not adding any songs, don't bother doing the rest of this function if (songs.Count == 0) { return; } foreach (string song in songs) { QueueSongNames.Enqueue(song); } if (queueType == QueueType.PlayImmediately) { PlayNextSong(); } }
public static void ClearQueue() { CurrentSong = null; MediaPlayer.Stop(); QueueSongNames.Clear(); }