سؤال

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?

هل كانت مفيدة؟

المحلول

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!

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top