我试图改变每3秒AudioTrack冠军,但我似乎不能改变它,或者使用下面这可能是不可能的:是否有可能改变AudioTrack标题每3秒
void timer_Tick(object sender, EventArgs e)
{
BackgroundAudioPlayer player = BackgroundAudioPlayer.Instance;
switch (player.PlayerState)
{
case PlayState.Playing:
if (recitation != null && recitation.Count > 0)
{
if (++ayaRecitationCounter == recitation.Count)
{
ayaRecitationCounter = 0;
recitationTimer.Stop();
}
else
{
player.Track.Title = ayaRecitationCounter.ToString(); //Exception occurs here recitationTimer.Interval=TimeSpan.FromSeconds(recitation[ayaRecitationCounter].AyaDuration);
lsbReadingChapter.SelectedIndex = ayaRecitationCounter;
lsbReadingChapter.ScrollIntoView(lsbReadingChapter.SelectedIndex);
}
}
break;
}
}
的应用是粉碎,并提供以下消息:
Operation is not valid due to the current state of the object.
at Microsoft.Phone.BackgroundAudio.AudioTrack.set_Title(String value)
如何更改标题?
谢谢!
Weere是否存在该Timer?主界面? – Romasz
是的,但我开始时,开始玩。初始化发生在构造函数中。 – ARH
在BackgroundAudioPlayer的构造函数中? – Romasz