Quite strange that code works fine on emulator but not on device. I am downloading an mp3 via http and storing it on isolatedstorage before I play it. Its like I am caching it forever. Next time if I have to play that mp3 again I simply do it from isolatedstorage. Now that seems to work on emulator but on device I am getting an error thrown by MediaElement (myMedia_MediaFailed function getting called). Debugger shows that file it is trying to play has the right size yet the error is there. I have 7.0 OS of WP7 and can t seem to find any tool which would let me at least grab the mp3 from isolatedstorage to play on PC just to see if file got saved fine. Under mywebClient_OpenReadCompleted function here is the code
isolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication();
bool checkQuotaIncrease = IncreaseIsolatedStorageSpace(e.Result.Length);
string audioFileName = "audiofile.mp3";
isolatedStorageFileStream = new IsolatedStorageFileStream(audioFileName, FileMode.Create, isolatedStorageFile);
long audioFileLength = (long)e.Result.Length;
byte[] byteImage = new byte[audioFileLength];
e.Result.Read(byteImage, 0, byteImage.Length);
isolatedStorageFileStream.Write(byteImage, 0, byteImage.Length);
isolatedStorageFileStream.Flush();
AudioPlayer.SetSource(isolatedStorageFileStream);
AudioPlayer.Play();