0
votes

I was created a recorder to save sound, I store the sound to Isolated Storage and used the following code to get the path:

using (IsolatedStorageFile isoFile = IsolatedStorageFile.GetUserStoreForApplication())
{
   if (isoFile.DirectoryExists("/Sound/"))
   {
      var element = (FrameworkElement)sender;
      SoundData data = (SoundData)element.DataContext;

      string name = data.FilePath;
   }
}

I get the path is "/Sound/130215507805691237.wav" in Isolated Storage. But how to I save the sound to my phone as physical file? Thanks

1
Isolated storage is the only physical file you can access. What are you trying to accomplish?Richard Szalay
I want store the physical file to my phone as song, then I can use music player to play the music.Howard Hee

1 Answers

2
votes

Use MediaLibraryExtensions SaveSong method like this

MediaLibrary library=new MediaLibrary();
SongMetadata smd=new SongMetadata()
{
    AlbumName = "AlbumName",
    Duration = TimeSpan.FromMinutes(2.50),
    Name = "SongName" 
};
MediaLibraryExtensions.SaveSong(library, new Uri(filePath, UriKind.RelativeOrAbsolute), smd, SaveSongOperation.CopyToLibrary);