Frage

This is another background audio resources are no longer available error in Windows Phone 7, but a different scenario. I have 2 apps, which both use BackgroundAudioPlayer to play background music.

When app A is playing background music, I press Home button to choose app B, play some music in app B, then return to app A.

There whenever app A use BackgroundAudioPlayer.Instance, it will throw InvalidOperationException with message "background audio resources are no longer available".

The only thing I can do is try/catch, which is of no use other than preventing the app to crash. And, I cannot call BackgroundAudioPlayer.Instance.Close() because it is no longer available.

How to deal with this ?

War es hilfreich?

Lösung

In this scenario you cannot rely on BackgroundAudioPlayer.Instance methods working - and you need to handle the InvalidOperationException to know that this has scenario occurred.

At this point you can restart your background audio agent again using BackgroundAudioPlayer.Instance.Play().

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top