Windows 8のメトロアプリで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);
ありがとうございました