我正在为音乐播放器创建一个应用,但在我的模拟器中没有音乐文件
所以我决定在MediaLibrary
我写了以下代码来添加歌曲:
public void addsong()
{
try
{
Uri songUri = new Uri("../Assets/samplemusic/02 Can't Remember to Forget You (feat. Rihanna).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);
}
catch (Exception ex)
{
}
}
但它不起作用,我不知道为什么
有人有想法吗?
答案 0 :(得分:0)
这个答案应该足以满足您的目的:
http://stackoverflow.com/a/23041512/1537726