Reputation: 5299
I want to read the filenames from the win8 music library and show them in a metro app.
Upvotes: 0
Views: 301
Reputation: 102
You can then use code similar to this:
var openPicker = new Windows.Storage.Pickers.FileOpenPicker();
openPicker.viewMode = Windows.Storage.Pickers.PickerViewMode.thumbnail;
openPicker.suggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.picturesLibrary;
openPicker.fileTypeFilter.replaceAll([".png", ".jpg", ".jpeg"]);
Upvotes: 0
Reputation: 320
You can access the music library by this:
SuggestedStartLocation = PickerLocationId.MusicLibrary
You can play it in a metro app like this for example:
MediaElement snd = new MediaElement();
StorageFolder folder = await Package.Current.InstalledLocation.GetFolderAsync("Sounds");
StorageFile file = await folder.GetFileAsync("bee.wav");
var stream = await file.OpenAsync(FileAccessMode.Read);
snd.SetSource(stream, file.ContentType);
snd.Play();
You can change location, I used this location within my app
Upvotes: 2