1

嗨,我正在尝试播放一首特定的歌曲,例如,如果我有一个包含 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"];

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

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

谢谢。

4

0 回答 0