<mediaelement name="myMediaElement" ismuted="True" stretch="Fill" width="768" height="500" unloadedbehavior="Stop" loadedbehavior="Manual"> <mediaelement.triggers> <eventtrigger routedevent="MediaElement.Loaded"> <eventtrigger.actions> <beginstoryboard> <storyboard slipbehavior="Slip"> <!-- The MediaTimeline has a RepeatBehavior="Forever" which makes the media play over and over indefinitely.--> <mediatimeline name="videomediaTimeline" storyboard.targetname="myMediaElement"> RepeatBehavior="Forever" /> </mediatimeline></storyboard> </beginstoryboard> </eventtrigger.actions> </eventtrigger> </mediaelement.triggers> </mediaelement>
public MainGameWindow() { InitializeComponent(); myMediaElement.Loaded += new RoutedEventHandler(myMediaElement_Loaded); } private void playVideoWithRepet() { try { string filePath = string.Empty; string _pathVedioRotater = _dynamicFilePath + "TopVideoRotate.xml"; var doc = new XmlDocument(); doc.Load(_pathVedioRotater); XmlNodeList setting = doc.GetElementsByTagName("Video"); foreach (XmlNode item in setting) { filePath = item.ChildNodes[2].InnerText.ToString(); } string videopath = _dynamicFilePath + "TopContanerVideo/" + filePath; videomediaTimeline.Source = new Uri(videopath, UriKind.RelativeOrAbsolute); doc = null; _pathVedioRotater = null; filePath = string.Empty; videopath = null; setting = null; } catch (Exception ex) { throw ex; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)