I can play files only from application storage, but, I have to play file from Library or another source. The I try to:
var storageFile = await Storag
If you want to play audio files from library, then you need to use KnownFolders
. GetFileFromApplicationUriAsync
won't work.
var storageFile = await KnownFolders.MusicLibrary.GetFileAsync("line.mp3");
var stream = await storageFile.OpenAsync(FileAccessMode.Read);
mediaElement.SetSource(stream, storageFile.ContentType);
mediaElement.Play();
If you want enumerate all the media file or all the folders then use this.
var AllStorageFiles = await KnownFolders.MusicLibrary.GetFilesAsync();
var AllStorageFolders = await KnownFolders.MusicLibrary.GetFoldersAsync();