0
我下载一个声音,并与.mp3
扩展这样的保存:的MediaElement不播放声音
var response = await client.GetStreamAsync(fileUrl);
using (IsolatedStorageFileStream fileStream = new IsolatedStorageFileStream(filePath, FileMode.Create, isolatedStorage))
{
using (BinaryWriter binaryWriter = new BinaryWriter(fileStream))
{
await response.CopyToAsync(fileStream);
}
}
现在,当我看向IsolatedStorage
由独立存储浏览器,我看到那里的文件,我可以玩它也。
我要访问并播放:
IsolatedStorageFile isolatedStorage = IsolatedStorageFile.GetUserStoreForApplication();
IsolatedStorageFileStream fileStream = isolatedStorage.OpenFile(filePath, FileMode.Open, FileAccess.Read);
musicMediaElement.SetSource(fileStream);
musicMediaElement.Play();
}
我什么也没听到。我不知道我做错了什么。
是否报告了任何错误或异常?确保您订阅了“MediaOpened”和“MediaFailed”事件以确认它开始播放,并且您听到任何错误消息。 –