How to update a video frame in MediaElement? C# WPF?

A solution is found. In XAML'e in the tag of the element you want to add a property ScrubbingEnabled="True".

There are MediaElement, it video AVI. By clicking on a button executes a method mediaElement.Play();on the other mediaElement.Pause();

There is a slider whose value is used for setting the position of the video.

public a DispatcherTimer _timer = new a DispatcherTimer();
 public int waitnum = 3000;
 double TotalTime = 0;

 public MainWindow()
 _timer.Interval = TimeSpan.FromSeconds(1);
 _timer.Tick += new EventHandler(_timer_Tick);

 void _timer_Tick(object sender, EventArgs e)
 double tPass = mediaElement1.Position.TotalSeconds;
 slider.Value = tPass;

 private void mediaElement1_MediaOpened(object sender, RoutedEventArgs e)
 slider.Maximum = mediaElement1.Than naturalduration.TimeSpan.TotalSeconds;

 private void slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
 TimeSpan ts = TimeSpan.FromSeconds(slider.Value);
 mediaElement1.Position = ts;
 textBox.Text = ts + " / " + mediaElement1.Than naturalduration;

 . . .</double>

If you click on "pause" (performed mediaElement.Pause();) and then move the slider, the position of the video changes, but the frame is not updated. How can I update the frame on pause?
October 10th 19 at 13:00
2 answers
October 10th 19 at 13:02
hmm... impossible to mark as "solution". - Raoul_Ernser78 commented on October 10th 19 at 13:05
October 10th 19 at 13:04
Try method InvalidateVisual
Unfortunately it did not help. - Raoul_Ernser78 commented on October 10th 19 at 13:07

Find more questions by tags CWPFVideoSliderC#