3

I am using the BackgroundAudioPlayer to play audio files stored in the isolated storage.

The user may want to delete one of these files. If the file is playing, the file is locked by the BackgroundAudioPlayer. Only after the track has finished playing can the file be deleted.

Even if I call the Stop function on the BackgroundAudioPlayer, the file is still locked.

How to get the BackgroundAudioPlayer to remove its lock?

Shawn Kendrot
  • 12,425
  • 1
  • 25
  • 41
BrainProxy
  • 107
  • 7

2 Answers2

1

Try set Track property to null.

Roman Golenok
  • 1,427
  • 9
  • 26
1

To release the audio file, you have to call the Close method of the BackgroundAudioPlayer.

http://msdn.microsoft.com/en-us/library/microsoft.phone.backgroundaudio.backgroundaudioplayer.close(v=vs.92).aspx

Kevin Gosse
  • 38,392
  • 3
  • 78
  • 94
  • I would say this is the correct answer to the question. Setting the Track to null might work (haven't tried), but seems more of coincidence that it works (maybe the setter calles Close()?) – Johan Paul Sep 25 '12 at 19:58