I can only play files from the application store, but I have to play the file from a library or other source. I'm trying to:
var storageFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("C:\\Users\\admin\\Music\\line.mp3")); var stream = await storageFile.OpenAsync(FileAccessMode.Read); mediaElement.SetSource(stream, storageFile.ContentType); mediaElement.Play();
It gives an exception: "An exception of type" System.ArgumentException "occurred in Polar.exe but was not processed in the user code. Additional information: the value does not fall into the expected range."
I tried mediaElement.Source (), but the element does not play sound. No exception, nothing.
I think this is a stupid problem, but I cannot find a solution. What am I doing wrong?
c # windows-store-apps
sahap
source share