Does anyone have a working (tested) example of code to play an audio file from isolated storage. The code I currently have, which doesn't throw an exception or make any sound, is:
MediaElement ME = new MediaElement();
ME.AutoPlay = false;
IsolatedStorageFile ISF = IsolatedStorageFile.GetUserStoreForApplication();
ME.SetSource(ISF.OpenFile("foo.wav", FileMode.Open));
ME.Play();
I've tried this using a number of different audio formats, encoded using Expression, but I always have the same problem.
Also, I'd quite like an example using the file browser to load the song from a file stream, however this is less important and the Isolated Storage example could easily be converted.
I've checked, and if I embed the file in the application, it plays fine. The problem is I want users to be able to load their own songs into the application, which will then be stored in and played from isolated storage.
Finally, as with the example, I'd rather be doing this in C# code, rather than XAML.