Ofirster
Ofirster

Reputation: 109

Next frame WPF mediaElement

I am trying to create a video player using WPF. I would like to create a button that jumps to the next frame in the video. How can I do it with mediaElement control?

Upvotes: 3

Views: 1855

Answers (1)

Lion King
Lion King

Reputation: 495

Follow this guide to calculate FPS and then as TyCobb suggested you can increment the position like this

TimeSpan t = TimeSpan.FromSeconds(newSecond);
System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() =>
{
    mediaElement1.Position = TimeSpan.FromSeconds(newSecond);
});

keep in mind to have

MediaElement.ScrubbingEnabled = True

Upvotes: 3

Related Questions