c# - How to access albums, artists, playlists in Windows Phone Runtime? -
c# - How to access albums, artists, playlists in Windows Phone Runtime? -
previously possible access albums
, genres
etc. using medialibrary
using(medialibrary library = new medialibrary()) { songcollection songs = library.songs; song song = songs[0]; mediaplayer.play(song); }
but not available in windows runtime apps. alternative way access data?
it's windows phone runtime app.
use this
var folder = windows.storage.knownfolders.musiclibrary; var files = await folder.getfilesasync();
use storageitemcontentproperties on storagefile , phone call getmusicpropertiesasync returns musicproperties.
storagefolder musicfolder = knownfolders.musiclibrary; ireadonlylist<storagefile> filelist = await musicfolder.getfilesasync(); foreach (var file in filelist) { musicproperties musicproperties = await file.properties.getmusicpropertiesasync(); debug.writeline("album: " + musicproperties.album); debug.writeline("rating: " + musicproperties.rating); debug.writeline("producers: " + musicproperties.publisher); }
c# windows-phone-8 windows-runtime windows-phone windows-phone-8.1
Comments
Post a Comment