我需要在我的metro应用程序中为Windows 8设置mediaElement控件的源!如何在metro app c#中设置mediaElement的源?
这里是我的代码:
string requestUrl = "ms-appx://ArcadiaDJ/Musique/test.mp3");
mediaElement_SoundEffect.Source = new Uri(requestUrl);
mediaElement_SoundEffect.play();
我可以设置信号源,但不MediaElement的工作玩。没有音乐
我发现这个解决办法,但我需要加载设置源页面动态
var openPicker = new Windows.Storage.Pickers.FileOpenPicker();
openPicker.SuggestedStartLocation =Windows.Storage.Pickers.PickerLocationId.MusicLibrary;
openPicker.FileTypeFilter.Add(".mp3");
openPicker.FileTypeFilter.Add(".wav");
file = await openPicker.PickSingleFileAsync();
mediaControl.SetSource(stream, file.ContentType);
谢谢
可能重复的[无法在Windows 8中播放声音](http://stackoverflow.com/questions/10984038/unable-to-play-sound-in-windows-8) – 2014-01-14 12:41:04