I work with Windows Phone 8. I need to get the path to the audio file. For the image it is done simply.

PictureCollection pictures = library.Pictures; Picture singlePict = pictures[index]; path = singlePict.GetPath().ToString(); 

But for audio there is no such function. Therefore, I am trying to use the MediaLibraryExtensions library. And there is a method GetPathFromToken, which allows you to get the path to the media file. Trying to do as follows:

 SongCollection songs = library.Songs; Song singleSong = songs[index]; name = singleSong.Name; path = library.GetPathFromToken(name); 

But nothing comes out. If anyone knows, tell me what to pass to the parameter.

    1 answer 1

    Token is a value that identifies a specific file that you receive if the user selects the Share or Edit command for a media element (picture, song, etc.), and your application can handle these commands (see Extensions in the application manifest), or if the user opens the file, and your application can handle this file type. The value of the token is the usual GUID, to which the OS maps a specific file to a specific path.

    So in your example you cannot get the path to the file.