I am trying to get the length of a sound file using this code:
MediaElement mysound = new MediaElement();
mysound.Source = new Uri(@"D:\majed\Phone\PhoneProject\PhoneProject\Sound\ring1.wav",UriKind.RelativeOrAbsolute);
double length = mysound.NaturalDuration.TimeSpan.Seconds;
but I receive an exception that says "mysound.NaturalDuration.TimeSpan.Seconds is null"
What can I do?
Note : I do not want using ( play ) or ( open ) method .
Thank you all