1

I am using the WindowsMediaPlayer element in a windows form and I would like to have an event listener that monitors the change of the Position property (double).

The built in Position changed event does not seems to be it.

How can I add an event without modifiying the orginal class or extending it?

Thanks in advance

Joseph Azzam
  • 105
  • 1
  • 14
  • What you ask for is entirely not possible by any normal means. First, you can't "add an event" to a control without modifying its source (which obviously you don't have). Second, the WMP control **does not** notify about position-change in any way. That event you found is risen whenever the `currentPosition` changes due to things **other than playback**. So, if you set the position manually, the event will be risen. When you "play" the video - not. The `currentPosition` is meant for polling. The only way to "watch" the position changing due to playback is what **ChaseRocker** answered. – quetzalcoatl Sep 07 '14 at 14:58
  • Thank you for the reply, I went with ChaseRocker 's answer after all.It's not efficient but it does the job. I wanted to create a script where the video would pause when it reaches a specified time. – Joseph Azzam Sep 10 '14 at 12:38

1 Answers1

2

Use a timer control or separate process to monitor the Ctlcontrols.currentPosition of the axwindowsmediaplayer and update your display.

Chase Rocker
  • 1,908
  • 2
  • 13
  • 14