Adding music to Windows Phone 7 emulator?

The emulator has something like 3 songs, which are not enough to make sure that the song selection code I'm working on will manage more than three songs.

So just wondering if this is possible?

+4
source share
2 answers

Unfortunately, there is no way to add songs to the emulator.
You will need to use a real device to verify this.

+2
source

In fact, you can use the application for this:

Uri file = new Uri("Assets/Happy.mp3", UriKind.Relative); //copy file to isolated storage var myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication(); var fileStream = myIsolatedStorage.CreateFile("someSong.mp3"); var resource = Application.GetResourceStream(file); int chunkSize = 4096; byte[] bytes = new byte[chunkSize]; int byteCount; while ((byteCount = resource.Stream.Read(bytes, 0, chunkSize)) > 0) { fileStream.Write(bytes, 0, byteCount); } fileStream.Close(); Microsoft.Xna.Framework.Media.PhoneExtensions.SongMetadata metaData = new Microsoft.Xna.Framework.Media.PhoneExtensions.SongMetadata(); metaData.AlbumName = "Some Album name"; metaData.ArtistName = "Some Artist Name"; metaData.GenreName = "test"; metaData.Name = "someSongName"; var ml = new MediaLibrary(); Uri songUri = new Uri("someSong.mp3", UriKind.RelativeOrAbsolute); var song = Microsoft.Xna.Framework.Media.PhoneExtensions.MediaLibraryExtensions.SaveSong(ml, songUri, metaData, Microsoft.Xna.Framework.Media.PhoneExtensions.SaveSongOperation.CopyToLibrary); 
+1
source

All Articles