如何播放特定的歌曲背景音频播放器Windows手机?

时间:2013-10-03 05:59:07

标签: 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)
    {

        BackgroundAudioPlayer.Instance.Close();

        BackgroundAudioPlayer.Instance.Play();

    }
    else
        BackgroundAudioPlayer.Instance.Play();
}

然后在我的AudioPlayer.cs中我得到了这首歌

//get the song
currentSong = (int)IsolatedStorageSettings.ApplicationSettings["currentSong"];

它工作正常,但加载歌曲需要太多时间。

所以请问有没有其他方法可以做到这一点?

感谢。

0 个答案:

没有答案
相关问题