1

In windows phone 8 application, I'm using AudioPlaybackagent to play a background audio.

I did the following scenario:

I play

  BackgroundAudioPlayer.Instance.Play(), 

while the song is playing I called

  BackgroundAudioPlayer.Instance.Stop() 

then play another song using mediaElement

The problem is that if I want to replay the first song usingBackgroundAudioPlayer.Instance.Play()

it returns an exception

  The background audio resources are no longer available.
Rachel Gallen
  • 27,943
  • 21
  • 72
  • 81
Developer
  • 1,803
  • 2
  • 15
  • 26

1 Answers1

0

If you want to play audio with the background agent, stop, and then play audio with the media element. I belive you'll have to do:

BackgroundAudioPlayer.Instance.Stop()
BackgroundAudioPlayer.Instance.Close()

Then attempt to play audio with the media element.

Derek Beattie
  • 9,429
  • 4
  • 30
  • 44
  • Did you see this? http://stackoverflow.com/questions/13769275/how-to-reuse-backgroundaudioplayer-after-close-method-called – Derek Beattie Feb 10 '13 at 14:41