0
很奇怪的是,代码在模拟器上工作正常,但在设备上无法正常工作。 我正在通过http下载一张mp3并将它存储在独立存储中,然后再播放它。它就像我永远缓存它。下一次,如果我必须再次播放该mp3,我只需从isolatedstorage中完成。 现在,似乎在模拟器上工作,但在设备上,我收到MediaElement(myMedia_MediaFailed函数被调用)引发的错误。 调试器显示它正在尝试播放的文件具有合适的大小,但错误在那里。 我有7.0操作系统的WP7,似乎无法找到任何工具,让我至少抓住从孤立存储的MP3在PC上播放只是为了看看文件得到保存罚款。这里 在mywebClient_OpenReadCompleted功能代码mp3音频没有通过隔离存储在wp7设备上播放,但在仿真器上工作
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();
能够验证在设备上下载的文件在PC上可以正常播放。这是通过ISETool.exe实现的,我需要升级到SDK 7.1 RC。使用该工具,我可以将下载的MP3从设备抓到PC。 – climbon