Try hooking up a PlayStateChange event handler and use it to re-start the player with the next URL. Here are a couple of snippets of code from a program of mine that repeats the same URL over and over again, but the principle should be the same.
// Reference to an Interop object for the COM object that interfaces with Microsoft Windows
// Media Player
private readonly WindowsMediaPlayer _windowsMediaPlayer = null;
// Number of repeats left, negative = keep looping
private int _repeatCount = -1;
...
// Instantiate the Windows Media Player Interop object
_windowsMediaPlayer = new WindowsMediaPlayer();
// Hook up a couple of event handlers
_windowsMediaPlayer.MediaError += WindowsMediaPlayer_MediaError;
_windowsMediaPlayer.PlayStateChange += WindowsMediaPlayer_PlayStateChange;
...
/// <summary>
/// Method to start the media player playing a file.
/// </summary>
/// <param name="fileName">complete file name</param>
/// <param name="repeatCount">zero = repeat indefinitely, else number of times to repeat</param>
[SuppressMessage("Microsoft.Usage", "CA2233:OperationsShouldNotOverflow", MessageId = "repeatCount-1")]
public void PlayMediaFile(string fileName, int repeatCount)
{
if (_windowsMediaPlayer == null)
return;
_repeatCount = --repeatCount; // Zero -> -1, 1 -> zero, etc.
if (_windowsMediaPlayer.playState == WMPPlayState.wmppsPlaying)
_windowsMediaPlayer.controls.stop(); // Probably unnecessary
_windowsMediaPlayer.URL = fileName;
_windowsMediaPlayer.controls.play();
}
...
/// <summary>
/// Event-handler method called by Windows Media Player when the "state" of the media player
/// changes. This is used to repeat the playing of the media for the specified number of
/// times, or maybe for an indeterminate number of times.
/// </summary>
private void WindowsMediaPlayer_PlayStateChange(int newState)
{
if ((WMPPlayState)newState == WMPPlayState.wmppsStopped)
{
if (_repeatCount != 0)
{
_repeatCount--;
_windowsMediaPlayer.controls.play();
}
}
}
Don't know if this will also work for your application, but maybe.
EDIT:
Just remembered that I answered a similar question a while back, and there I posted my entire program. https://stackoverflow.com/a/27431791/253938