Video Duration

Mar 19, 2012 at 11:19 AM

WPF Media Kit indeed is great for video playback. However, I'm curious if there's any way I can retrieve the total duration of the video?

Sorry I'm new to this.

Mar 19, 2012 at 2:29 PM


- Stephen

Mar 20, 2012 at 3:54 AM

It returns 0 value tho..

I wonder how I should make it to work.

dvdPlayer.Source = new Uri(url);
long duration = 0;

duration = dvdPlayer.MediaDuration;

Mar 20, 2012 at 2:31 PM

The source probably hasn't finished loading yet -- it is asynchronous.  You'll need to delay before reading it.