I have a UWP page with a MediaPlayerElement. I use it to play some local files (mp3) using a MediaPlayBackList and everything goes right.
But when I do Frame.GoBack() and later I try to Directory.Delete(URL, true) with these files, an System.IO.IOException is happening (Directory is not empty).
I see on Windows Explorer that some files of the playlist are in use and can´t be delete until app is closed. This only happen when playing has started, before I can delete whole directory with no errors.
I have tried calling:
player.MediaPlayer.Dispose();
playbackList = null;
But nothing changes... What could I do to solve this issue? I would like to dispose MediaPlayer to let files unused. I am targeting Anniversary Update (14393) to be able to use MediaPlayer.
Thank you.