1

What I want to do is the following:

  1. When I'll make a click action on the button1 I want to move my "avi" one frame forward.
  2. When I'll make a click action on the button2 I want to move my "avi" one frame backward.

I resolved the first point like this:

private void button2_Click(object sender, EventArgs e)
        {
           ((WMPLib.IWMPControls2)axWindowsMediaPlayer1.Ctlcontrols).step(1);
        }

but I have no idea how can I resolve second point (frame backward), step(-1) doesn’t work. I'll glad for any help in this case.

fredtantini
  • 15,966
  • 8
  • 49
  • 55
frank
  • 223
  • 1
  • 3
  • 14
  • 1
    This is in general troublesome, a video stream doesn't normally contain full frames. It is composed of a GOP, a full key frame followed by intermediate frames that only encoded the differences from the previous frame. An essential compression technique. Going forward is relatively easy, backwards is hard because you can't "subtract" the intermediate frame. You have to go back to the start of the GOP and apply the intermediate frames. WMP entirely lacks that level of control. – Hans Passant Aug 21 '14 at 11:32
  • Thanks for your opinion. hmm I need to resolve this problem in some way so maybe there is some possibility to move forward and backward by some time ? – frank Aug 21 '14 at 13:33

2 Answers2

0

Comment on MSDN about step method.

I seems this problem cannot be resolved by Microsoft ;-)

frank
  • 223
  • 1
  • 3
  • 14
0

I did manage to figure out a work-around to this issue for anyone still trying to do this.

To step forward, we can use the step(1) command as intended.

To step backward, we will set the playback position to be about 1 frame backwards from the current playback position, then we will step forward one frame. Conveniently, this actually ends up "landing" on the previous frame.

Private Sub StepForward()
    wmp.Ctlcontrols.step(1)
End Sub

Private Sub StepBackward()
    wmp.Ctlcontrols.currentPosition -= (1 / wmp.network.encodedFrameRate)
    wmp.Ctlcontrols.step(1)
End Sub

Admittedly, this isn't a great way of doing this, but it actually seems to work pretty consistently for MP4 files. I haven't tried this with other file formats, but I believe this method should still work.

Jyclop
  • 469
  • 1
  • 6
  • 15