I am using MediaTimeline and MediaClock to control the WMV video playback.
Timeline = new MediaTimeline(new Uri(VideoFileName));
Clock = Timeline.CreateClock(true) as MediaClock;
When I look at the Clock.NaturalDuration, value is set to Automatic and does not
contain duration TimeSpan yet.
When I assign Clock to MediaElement and video starts playing, I can now see the NaturalDuration.TimeSpan is present and OK.
Is there a way to get the video duration other than assigning clock to media element and playing?
Is there a way to get duration even without usage of media element (this would be the best)?
I had similar need to check out video length, so I read that this property is available when MediaOpened event is being raised, otherwise is set to Automatic – read this
http://msdn.microsoft.com/en-us/library/system.windows.controls.mediaelement.naturalduration(v=vs.95).aspx