The problem is that when using MediaElement ( .NET, VS2008 ), when I get to the point where I want to check the length of ( in my case ) an audio file, I do something like this ...
Expand|Select|Wrap|Line Numbers
- MediaElement me = new MediaElement();
- ...
- ...
- ...
- double milliseconds = 0;
- bool gotTime = me.NaturalDuration.HasTimeSpan;
- if( gotTime )
- {
- milliseconds = me.NaturalDuration.Timespan.TotalMilliseconds;
- }
... and an exception gets thrown SOME TIMES ( other times it runs through just fine ), saying that there is no time span. BUT, when the exception gets thrown, while stepping through the code, 'me.NaturalDuration.Timespan.TotalMilliseconds' has a value, and not just a value, but the correct value. Why won't the value return when it's right there!?
If anyone can help I would greatly appreciate it, as this issue is driving me crazy.