Hi All,
I want to develop media player in windows phone application. In this application I want all media file selected at runtime from phone storage & SD card.
i did try, i won't do that. I need your help for the doing the same task.... Thanks In Advance...
Aditya PatilPosted Jul 8, 2014, 7:08 AM
Music Library capability in Capabilities
File Type Association in Declarations (I'm not sure if this is needed if you only access Music Library)
then you will be able to retrieve files from Music Library folder like this:
StorageFolder folder = KnownFolders.MusicLibrary;
// below code will work unless 'fileName.mp3' is in
// your Music folder either on phone or SD card
StorageFile file = await folder.GetFileAsync("fileName.mp3");
// you can access them also with path, but in this case
// also Folders must be in Music folder
string path = @"Test\ccc.mp3";
StorageFile file = await folder.GetFileAsync(path);
To sum up you will be able to aceess by KnownFolders.MusicLibrary only to files which are either on Phone or SD card but in Music folder - their paths will be then:
C:\Data\Users\Public\Music\test.mp3 - for Phone
D:\Music\Test\test2.mp3 - for SD card
Remember that accessing by StorageFolder.GetFileAsync() works relative to the StorageFolder (it will also work with full path, see remark below):
The name (or path relative to the current folder) of the file to retrieve.
In this case to get above files you will use filenames like: test.mp3 and Test\test2.mp3.
You won't be able to get other files like D:\xxx.mp3 - it isn't in Music Library - it is on SD card, if you want to access it you will have to do it by KnownFolders.RemovableDevices - when you have added required capabilities, then you should be able to access that via fullpath.
Naveen Kumar KaushikPosted Jul 2, 2014, 10:29 AM
Abhishek JaiswalPosted Jul 2, 2014, 12:48 AM
check'em out:
http://msdn.microsoft.com/en-us/magazine/hh975344.aspx
http://www.jevgeni.net/2010/09/29/creating-a-simple-media-player-for-windows-phone/
:)