This can be achieved by adding Markers to your MediaElement. Add a marker on the time where you want to loop the file. When the marker is reached, set the position of the MediaElement to 0.
Something like this:
void mdeBackgroundMusic_MediaOpened(object sender,
EventArgs e)
{
TimelineMarker marker =
new TimelineMarker();
marker.Time = TimeSpan.FromMilliseconds(TIME_OF_MP3_IN_MILLISECONDS);
marker.Text = "foo";
// Dummy value requred
marker.Type = "yada";
// Dummy value requred
Billy Porter
Member
46 Points
23 Posts
Re: Looping MP3 or WMA without a gap
Dec 28, 2007 12:54 AM | LINK
This can be achieved by adding Markers to your MediaElement. Add a marker on the time where you want to loop the file. When the marker is reached, set the position of the MediaElement to 0.
Something like this:
void mdeBackgroundMusic_MediaOpened(object sender, EventArgs e){
TimelineMarker marker = new TimelineMarker();
marker.Time = TimeSpan.FromMilliseconds(TIME_OF_MP3_IN_MILLISECONDS);
marker.Text = "foo"; // Dummy value requred
marker.Type = "yada"; // Dummy value requred
mdeBackgroundMusic.Markers.Add(marker);
mdeBackgroundMusic.MarkerReached += new TimelineMarkerEventHandler(mdeBackgroundMusic_MarkerReached);
} void mdeBackgroundMusic_MarkerReached(object sender, TimelineMarkerEventArgs e)
{
mdeBackgroundMusic.Position = TimeSpan.FromMilliseconds(0);
}
HTH,
Billy