C# 如何播放特定歌曲背景AudioPlayer windows phone?
嗨,我正在尝试播放一首特定的歌曲,例如,如果我有一个包含100首歌曲的列表,我想播放20首歌曲 为此,我使用以下代码C# 如何播放特定歌曲背景AudioPlayer windows phone?,c#,windows-phone-7,windows-phone-8,windows-phone,C#,Windows Phone 7,Windows Phone 8,Windows Phone,嗨,我正在尝试播放一首特定的歌曲,例如,如果我有一个包含100首歌曲的列表,我想播放20首歌曲 为此,我使用以下代码 private void playSong(int n) { IsolatedStorageSettings.ApplicationSettings["currentSong"] = n; if (BackgroundAudioPlayer.Instance.PlayerState == PlayState.Playing) { Bac
private void playSong(int n)
{
IsolatedStorageSettings.ApplicationSettings["currentSong"] = n;
if (BackgroundAudioPlayer.Instance.PlayerState == PlayState.Playing)
{
BackgroundAudioPlayer.Instance.Close();
BackgroundAudioPlayer.Instance.Play();
}
else
BackgroundAudioPlayer.Instance.Play();
}
然后在我的AudioPlayer.cs中我得到了这首歌
//get the song
currentSong = (int)IsolatedStorageSettings.ApplicationSettings["currentSong"];
它工作正常,但加载歌曲需要太多时间
请问还有其他方法吗
谢谢。如果你知道这首歌的位置和文件名,加载它应该不会花太长时间。显示按索引获取歌曲的代码段。