I\'m playing a video in WPF.i want it to loop so what I did is when the mediaended event fires, I play back my video. so this will get me a loop. prob is why do u I have to
You don't have to set the source again.Just set the position of the mediaelement to the start on the media_ended event
private void MediaElement_MediaEnded(object sender, RoutedEventArgs e)
{
((MediaElement)(sender)).Stop();
((MediaElement)(sender)).Position = new TimeSpan(0, 0, 0);
((MediaElement)(sender)).Play();
}
You may need to set MediaElement.LoadedBehavior to Manual
EDIT
I have tried loading an asf file with the REPEAT tag and its working fine
Simple ASX Demo
Vista Butterfly Video
Microsoft Corporation
(c)2007 Microsoft Corporation
But i think the inbuilt playlist handling mechanism of mediaelement has some flaws.I recommend following the workaround mentioned in the below link
http://blog.revolunet.com/index.php/general/wpf-mediaelement-asx-workaround
Post comment here if you have any problem