windows-phone-7 - WP7如何检测音轨何时结束?

标签 windows-phone-7 events audio agent

我在Windows Phone 7应用程序中使用BackgroundAudioPlayer代理。跟踪结束时,代理端接收TrackEnded事件,但UI端未接收任何事件。

另外,当我有意将音频轨道的位置设置为结尾时,然后调用Play(),代理端将接收TrackEnded事件(因为该轨道已结束),但是UI端会在其Stopped处理程序中接收到PlayStateChanged。太奇怪了 !

如何让UI知道轨道已经结束?通过隔离存储进行通信不是我的最爱!

最佳答案

通过研究和一些测试,使用隔离存储作为BackgroundAudioPlayer的Background和Foreground实例之间的中间人,仍然是Windows Phone 7的唯一途径。这里提到了这些选项(我知道您知道)。 。

http://blogs.msdn.com/b/wpukcoe/archive/2012/02/10/background-audio-in-windows-phone-7-5-part-2.aspx

http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202944(v=vs.105).aspx

https://stackoverflow.com/a/11419680/247257

彼得·托尔(Peter Torr)也证实了这一点:

For example, the agent may need to tell the foreground “I just started pre-downloading the next track,” or “I updated a database table and you should refresh your state”. Such notifications are impossible to create with Windows Phone OS 7.1; at best you can model them by using polling techniques, but this approach is inefficient and prone to errors.



唯一的好消息是,在同一篇文章中,他给出了Windows Phone 8的解决方案(使用IPC的命名事件),该解决方案更加可靠...

http://blogs.windows.com/windows_phone/b/wpdev/archive/2013/03/27/using-named-events-to-coordinate-foreground-apps-and-background-agents.aspx

关于windows-phone-7 - WP7如何检测音轨何时结束?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13618390/

相关文章:

c# - WP7 - 通过代码而不是 XAML 淡化用户控件

android - 如何处理左滑和右滑事件

javascript - 奇怪的 setTimeout 问题

events - Node.js 事件发射器绑定(bind)到多个实例

iOS:是否可以同时从耳机和扬声器发送音频?

javascript - Recorder.js 计算和偏移记录延迟

windows-phone-7 - 在桌面上运行 Windows Phone 7 应用程序

silverlight - Windows Phone 7 silverlight 用户控制 : data binding not working on custom property

ios - swift 的 spritekit 声音设计

windows-phone-7 - 获取 dropbox access_token 适用于 Windows 但不适用于 Windows Phone