shedskin
shedskin

Reputation: 45

how to import media library in windows store app?

I made a media player windows store app where I used filepicker to pick file from pc to play. but I want to import the music library and video library and show the content in the homescreen to make it easy selecting files to play. how to do it? please help..

I'm using c# and xaml for my app.

Upvotes: 0

Views: 555

Answers (2)

shedskin
shedskin

Reputation: 45

this is what finally worked for me..

IReadOnlyList<Windows.Storage.StorageFile> resultsLibrary; 
// to store the library


resultsLibrary = await Windows.Storage.KnownFolders.MusicLibrary.GetFilesAsync(CommonFileQuery.OrderByName);
// this is the list created.


//and this is what shows the media library in a list in xaml
 length = resultsLibrary.Count;
            list.Items.Clear();


            for (int j = 0; j < length; j++)
            {
                list.Items.Add(resultsLibrary[j].Name);
            }

Upvotes: 0

Nate Diamond
Nate Diamond

Reputation: 5575

To do this, you must use the KnownFolders class. You must first add the Music Library and Videos Library capabilities in your app manifest, then you can access them via that class.

Upvotes: 1

Related Questions