Search code examples
c#winformswmplib

Firing event when time changes on axwindowsmediaplayer


I have a windows application. I am using axwindowsmediaplayer which is in AxInterop.WMPLib dll.I dont have any problem about playing the videos, but I want to fire an event when the user goes to a specific time by clicking on media player . I looked in the dll files but i couldnt find such an event. Can anyone help me about how can i fire an event when user goes to another time on video ?

Thanks


Solution

  • How about the PositionChange event?

    Edit

    A short example:

    public Form1()
    {
      // ...
      axWindowsMediaPlayer1.PositionChange += axWindowsMediaPlayer1_PositionChange;
    }
    
    void axWindowsMediaPlayer1_PositionChange(object sender, AxWMPLib._WMPOCXEvents_PositionChangeEvent e)
    {
      MessageBox.Show("The user changed the position from " + e.oldPosition + " to " + e.newPosition);
    }