Search Wiki:
Resource Page Description
An example of a C# .NET Class that wraps a MediaPlayer and repeats the playback of a WAV file in a loop until stop method is called.

This was a "hack" i put together to get around using MediaTimeline technique that simply did not work for me for some reason.

For more information on MediaPlayer class see:
http://msdn.microsoft.com/en-us/library/system.windows.media.mediaplayer.aspx

For more information on MediaTimeline class see:
http://msdn.microsoft.com/en-us/library/system.windows.media.mediatimeline.aspx

Usage Example

If you are not sure how to use this very simple class, here is an example:

public Form1()
{
InitializeComponent();
}

RepeatMediaPlayer mediaRepeat;

private void Form1_Load(object sender, EventArgs e)
{
const string FilePath = @"C:\temp\Testing 1 2 3\testing12.wav";

mediaRepeat = new RepeatMediaPlayer(FilePath);
mediaRepeat.Play();

}

private void buttonStop_Click(object sender, EventArgs e)
{
mediaRepeat.Stop();
}

private void buttonPlay_Click(object sender, EventArgs e)
{
mediaRepeat.Play();
}
Last edited May 6 2009 at 4:41 AM  by Dmitry, version 5
Updating...
Page view tracker