使用WP8 BackgroundAudio [英] Working with WP8 BackgroundAudio

查看:76
本文介绍了使用WP8 BackgroundAudio的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用WP8和 Microsoft.Phone.BackgroundAudio,我让它运行正常n它是自己的背景。但是,我找不到在AudioStreamingAgent或AudioPlayer
上触发的事件,它会让我知道另一个应用程序何时接管了音频队列或整个BackgroundAudio播放器。


例如。 MyApp正在播放音频。我打开Audible Player(来自Audible.com)选择一本书并点击播放。由于我的主应用程序不在后台运行,因此当我再次打开我的应用程序并且Player.State现在未知时,我只会更改播放状态。所以
我无法保存到我正在播放的文件中的文件。当它失去对背景音频的控制权时,是否会出现播放器或音频流媒体代理的事件?



谢谢

解决方案

您使用的是AudioPlayerAgent吗?


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


您将收到以下通知:



OnUserAction:暂停


OnPlayStateChangedPaused



请参阅此sa mple:


http ://code.msdn.microsoft.com/wpapps/Background-Audio-Player-b5f70b13/sourcecode?fileId = 86859& pathId = 1826206550


Jeff


I am working with WP8 and the Microsoft.Phone.BackgroundAudio, I have it running fine n it's own context. However I can't find an event that fires either on the AudioStreamingAgent or the AudioPlayer that will let me know when another Application has taken over the Audio Queue or the entire BackgroundAudio Player.

e.g. MyApp is playing audio fine. I open up Audible Player(From Audible.com) choose a book and click play. As my Primary app does not run in the background, I only get a Play state Changed when I open my App Again and the Player.State is Now Unknown. So I was unable to save to a file where in the file I was playing. Is there an event that will tall the player or audio streaming agent when It loses control of the background audio?

thanks

解决方案

Are you using the AudioPlayerAgent?

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

You will get these notifications:

OnUserAction: Pause

OnPlayStateChangedPaused

See this sample:

http://code.msdn.microsoft.com/wpapps/Background-Audio-Player-b5f70b13/sourcecode?fileId=86859&pathId=1826206550

Jeff


这篇关于使用WP8 BackgroundAudio的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆