1

First of all, I'm new to C#, so bear with me.

I am making an application, that shows an .avi file in windows media player like this:

private void button1_Click(object sender, EventArgs e)
    {
        axWindowsMediaPlayer1.URL = @"C:BlaBla\Family Guy\Season 10\S10E16.HDTV.x264-LOL.avi";
    }

I've found out that you cant fastforward or fastrewind in an .avi file, because it's not indexed. But using the WMP-slider of axWindowsMediaPlayer1, you can set the file to play at a specific point. For instance, start the movie, and then drag the slider to 05:00 to skip the first 5 minutes.

I want to do this programaticly, but i have no clue as to how?

Răzvan Flavius Panda
  • 21,730
  • 17
  • 111
  • 169
user1285334
  • 309
  • 3
  • 13
  • Just like you set the URL property on the COM, you'll have to do the same for setting start time. If there is a property is the question – Quintium Jun 07 '12 at 13:40

1 Answers1

1

Disclaimer: I've never used this before.

However, it looks from the documentation that you can set the position in the video like this:

axWindowsMediaPlayer1.Ctlcontrols.currentPosition = 300d;

(Where the value is how many seconds from the beginning of the video you want to navigate to - I've set it to 5 minutes in as requested).

Edit: From the comments below - to fast forward, there is a method to do that for you. You can check if you can do it first, there's an example in the documentation here that I've modified for you:

if (axWindowsMediaPlayer1.Ctlcontrols.get_isAvailable("fastForward"))
{
   axWindowsMediaPlayer1.Ctlcontrols.fastForward();
}

This checks to see if it can fast forward, then plays at 5x normal speed until you tell it to do something else, or it hits the end of the video I guess!

Bridge
  • 29,818
  • 9
  • 60
  • 82
  • I actually found this like, a couple of seconds before you answered, but youre right, it works! Except, its in a double, in miliseconds. So: "axWindowsMediaPlayer1.Ctlcontrols.currentPosition = 10.745329;" – user1285334 Jun 07 '12 at 13:48
  • 1
    Thanks Bridge. I know of those functions, but they only work with my .mp4 files, not the .avi (as i said, couse theyre not indexed) BUT instead you can do this: "axWindowsMediaPlayer1.Ctlcontrols.currentPosition += 5.0;" and run that in a loop. Thanks for the help man! – user1285334 Jun 07 '12 at 13:58