AudioPlaybackAgent中的定时器

Rei*_*ter 6 c# dispatchertimer background-agents background-audio windows-phone-8

我有一个使用的互联网广播应用程序BackgroundAudioPlayer.

我需要音频播放代理中的一个计时器,它将更新从Internet广播电台的API中提取的BAP当前播放曲目的曲目标题.

添加DispatcherTimer到音频播放代理程序给我一个跨线程异常,并使用:

Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                // Code
            });
Run Code Online (Sandbox Code Playgroud)

没工作.

我需要这里的代码,因为如果我将更新代码放在应用程序本身,当用户导航离开应用程序时,更新会停止(与Windows 8的行为非常不同).

我不能使用预定代理,因为它们每30分钟只运行一次(IIRC).

这是可能的还是不能在Windows Phone上完成?

juh*_*iis -1

您是否考虑过更新后台音频播放器代理中的信息,如下所示的轨道标签中。

string newTag = "whatever you need to show";
AudioTrack track = BackgroundAudioPlayer.Instance.Track;
track.BeginEdit();
track.Tag = newTag;
track.EndEdit();
Run Code Online (Sandbox Code Playgroud)

然后在需要时通过应用程序在前端读取该标签?