AudioPlaybackagent - WP8

451 Views Asked by At

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.
1

There are 1 best solutions below

1
On

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.