I have a Windows Metro application written in C #.
Here is the code that I use to select a file from the local music library:
FileOpenPicker openPicker = new FileOpenPicker(); openPicker.ViewMode = PickerViewMode.Thumbnail; openPicker.SuggestedStartLocation = PickerLocationId.MusicLibrary; openPicker.FileTypeFilter.Add(".mp3"); openPicker.FileTypeFilter.Add(".wav"); StorageFile file = await openPicker.PickSingleFileAsync(); if (file != null) { myMediaElement.Source = file; //error here } else { //error here }
It says that StorageFile cannot be converted to System.Uri , used to change the source of the MediaElement. How to make my file uri link? It seems that Uri("...") only accepts String where the file location is.
Hendra anggrian
source share