0
目前我开发了可以播放声音/音频功能的Windows 10移动应用程序。 当我编写这个语句来播放音频/声音时,当图像点击事件被点击时它会显示错误。 如下的源代码:UWP-系统例外:指定路径无效
MediaElement mysong = new MediaElement();
try
{
var folder = await StorageFolder.GetFolderFromPathAsync(@"ms-appx://Assets/Media/");
if (folder != null)
{
var file = await folder.GetFileAsync("police_alarm.mp3");
if (file != null)
{
var stream = await file.OpenReadAsync();
mysong.SetSource(stream, file.ContentType);
mysong.Volume = 100;
mysong.Play();
}
}
else
{
MessageDialog dialog = new MessageDialog("Siren can't play !!! Please keep yourself safe !!!", "Error");
await dialog.ShowAsync();
}
}
catch(Exception ex)
{
MessageDialog dialog = new MessageDialog(ex.ToString(), "Error");
await dialog.ShowAsync();
}
的是,这方面的任何解决方案?
谢谢。
什么是错误? –
@KenTucker错误“系统异常:指定的路径无效”。谢谢。 –