public static void GetNowPlaying(out Song previousSong, out Song currentSong, out Song nextSong, out Song subsequentSong) { Playlist playlist = NowPlayingInformation.CurrentPlaylist; int previousIndex, currentIndex, nextIndex, subsequentIndex; NowPlayingInformation.GetNowPlayingIndices(out previousIndex, out currentIndex, out nextIndex, out subsequentIndex, playlist); previousSong = playlist.GetSong(previousIndex); currentSong = playlist.GetSong(currentIndex); nextSong = playlist.GetSong(nextIndex); subsequentSong = playlist.GetSong(subsequentIndex); }
public static void SkipToNextSong(CoreDispatcher dispatcher, Playlist playlist = null) { NowPlayingInformation.SkipToNextSong(true, playlist); var t = Task.Run(new Action(() => { if (!ServerInitialized.WaitOne(0)) { StartBackgroundAudioTask(dispatcher); } ValueSet message = new ValueSet(); message.Add(Constants.StartPlaying, null); BackgroundMediaPlayer.SendMessageToBackground(message); })); }
public static bool SkipToPreviousSong(CoreDispatcher dispatcher, Playlist playlist = null) { if (BackgroundMediaPlayer.Current.Position.TotalSeconds > 5) { BackgroundMediaPlayer.Current.Position = TimeSpan.FromSeconds(0); //Just restart the song if it is more than 5 seconds into the song return(false); } NowPlayingInformation.SkipToPreviousSong(true, playlist); var t = Task.Run(new Action(() => { if (!ServerInitialized.WaitOne(0)) { StartBackgroundAudioTask(dispatcher); } ValueSet message = new ValueSet(); message.Add(Constants.StartPlaying, null); BackgroundMediaPlayer.SendMessageToBackground(message); })); return(true); }