Prohibit WindowsMediaPlayer wmmpsMediaEnded event

30 views Asked by At

I have C# program in which I use WMPLib WindowsMediaPlayer. When playing goes to an end, it goes to these states: wmppsMediaEnded --> wmppsTransitioning --> wmppsStopped.

By going to this chain of states, WindowsMediaPlayer.controls.currentPosition sets to 0;

So when player goes to an end, it stops playing and when I click play button, it starts playing from the start again.

I want player not to go into wmppsMediaEnded state and therefore not to start from beginning afterwards. Is it possible?

I expected that WindowsMediaPlayer should have property, that prohibits to go to the wmppsMediaEnded state when playing ends, but it does not.

1

There are 1 answers

0
guresha On

I was able to solve the problem. When player goes into wmppsStopped state, I set WindowsMediaPlayer.controls.currentPosition = WmpInstance.currentMedia.duration;

So when playing is finished, player position stays at the end, even though it goes into stopped state.