WP7背景音乐资源不再可用 [英] WP7 background audio resources are no longer available
问题描述
我用 BackgroundAudioPlayer
我的Windows Phone 7的音乐和放大器;视频应用。我玩一些音乐后,我用 MediaPlayerLauncher
播放视频,那么preSS返回,返回到我的应用程序。还有,每当我用 BackgroundAudioPlayer.Instance
。我收到错误的背景音乐资源不再可用
I'm using BackgroundAudioPlayer
for my Windows Phone 7 music & video application. After I play some music, I play video using MediaPlayerLauncher
, then press Back to return to my app. There whenever I use BackgroundAudioPlayer.Instance
. I receive error "The background audio resources are no longer available".
<一个href=\"http://social.msdn.microsoft.com/Forums/en-US/wpdevelop/thread/f1272e7c-e138-4d95-9ee2-0fb08309d2f4/\"相对=nofollow>在MSDN上有人建议使用try / catch语句,但是这不是一个好主意,可以减缓应用程序。
Someone on MSDN suggests using try/catch, but this is not a good idea, and can slow down the app.
其他建议调用 BackgroundAudioPlayer.Instance.Close()
推出前的MediaPlayer
。然而,当我播放音乐,代理负载为.dll再次,这需要很多时间。
Other suggests call BackgroundAudioPlayer.Instance.Close()
before launch MediaPlayer
. However, when I play music, the agent load .dll again, which takes very much time.
如何解决这一问题?
推荐答案
如果您在音频后播放视频的OS肯定会终止的背景音乐播放器。从你的问题看来这是这将证实这一点的时候可重复的100%。你唯一的选择是重新启动该后台音频播放器在调用 BackgroundAudioPlayer.Instance.Close()
,然后发挥你的视频了。哪像你说的,需要重新加载您的播放器的DLL当您启动BAP。
If you play a video after your audio the OS will definitely "terminate" your Background Audio Player. From your question it seems this is reproducible 100% of the time which would confirm this. Your only option is to restart the background audio player again after you have called BackgroundAudioPlayer.Instance.Close()
, and then played your video. Which as you said will require reloading your player DLL when you start the BAP.
更新从评论跟进
如果你没有实现流式音频剂,但只有一个AudioPlayer剂没有一个过程,你反正杀。操作系统旋转起来的过程作为与时,它需要得到你处理一个动作(例如:用户的动作,跟踪结束,关闭)。
If you aren't implementing a streaming audio agent but only an AudioPlayer agent there isn't a process for you to kill anyway. The OS spins up a process as and when it needs to get you to process an action (e.g.: user action, track ended, shutdown).
BackgroundAudioPlayer.Instance.Close()
只是确保该操作系统干净释放这些资源的情况下,如OP了。
BackgroundAudioPlayer.Instance.Close()
just makes sure that the OS releases those resources cleanly in a scenario such as the OP has.
要重新启动背景音乐,只需拨打 BackgroundAudioPlayer.Instance.Play()
试。
To restart background audio, just call BackgroundAudioPlayer.Instance.Play()
again.
这篇关于WP7背景音乐资源不再可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!