views:

802

answers:

2

I have a PlayList loaded into my WMP instance, and I want it to loop just one song. Everything I've Googled up so far tells me to do this:

private AxWindowsMediaPlayer wmp;
wmp.settings.setMode("loop", true);

However, this only seems to make the entire PlayList repeat. The behavior I want is that, if I enable "repeat" when song 5 in the PlayList is playing, then song 5 will keep automatically repeat when it finishes (instead of proceeding to song 6). Most car MP3 players already work this way; is there a nice native way to do this in my C# program, or will I have to devise a "hack" solution, like intercepting the event that fires when the next song is loaded?

A: 

Could you not handle the PlayStateChange event and detect when the MediaEnded state has been set for the current track and just rewind it?

James
Yep, in fact that was one of the ways I was thinking of doing it... I just wanted to make sure that there wasn't a "native" way of handling this, before I did a bunch of custom coding.
Professor Mustard
A: 

Try to create a new set with only one song that you want to play over and over again.

Machta
Well, that would solve the problem, but what happens when I want to turn off repeat? I'd need a mechanism to reload the original playlist and jump back to the exact track and position that I was at when I turned off "repeat". It would be simpler to handle the play state and just store a flag to know whether I'm repeating or not.
Professor Mustard