Below is a sample code snippet that demonstrates how to copy a song (audio) to the Windows Phone hub/library Programatically using C#.
How to Copy a Song to Windows Phone Music Hub/Library using C#?
Uri songUri = new Uri("test.mp3", UriKind.RelativeOrAbsolute);
SaveFileToIsolatedStorage(songUri, "test.mp3");
MediaLibrary lib = new MediaLibrary();
SongMetadata metadata = new SongMetadata
{
GenreName = "Super Hit Songs",
Name = "Song 1",
AlbumName = "My Collections",
AlbumArtUri = new Uri("ApplicationIcon.png",UriKind.RelativeOrAbsolute)
};
MediaLibraryExtensions.SaveSong(lib, songUri, metadata, SaveSongOperation.CopyToLibrary);The SaveFileToIsolatedStorage is explained in the How to Save File to Isolated Storage in Windows Phone 8? Article
Leave a Reply