title: Video automatically stop after 8 to 10 minutes in WPF
body: <p>I am using Media element in wpf and playing a video in repeat behaviour but after some time my video doesn't play please suggest what i need to do so that my video never stop or hangs.
  Code which i use is given below</p>
  
  <p>Front End:- </p>
  
  <pre><code>  &lt;MediaElement Name="myMediaElement" IsMuted="True" Stretch="Fill" Width="768" Height="500" UnloadedBehavior="Stop" LoadedBehavior="Manual"&gt;
                      &lt;MediaElement.Triggers&gt;
                          &lt;EventTrigger RoutedEvent="MediaElement.Loaded"&gt;
                              &lt;EventTrigger.Actions&gt;
                                  &lt;BeginStoryboard&gt;
                                      &lt;Storyboard SlipBehavior="Slip"&gt;
  
                                          &lt;!-- The MediaTimeline has a RepeatBehavior="Forever" which makes the media play
                   over and over indefinitely.--&gt;
                                          &lt;MediaTimeline Name="videomediaTimeline" Storyboard.TargetName="myMediaElement"  
                                                  RepeatBehavior="Forever" /&gt;
  
                                      &lt;/Storyboard&gt;
                                  &lt;/BeginStoryboard&gt;
                              &lt;/EventTrigger.Actions&gt;
                          &lt;/EventTrigger&gt;
                      &lt;/MediaElement.Triggers&gt;
                  &lt;/MediaElement&gt;
  </code></pre>
  
  <p>Code Behind:- </p>
  
  <pre><code>public MainGameWindow()
          {
              try
              {
                  InitializeComponent();                
                  myMediaElement.Loaded += new RoutedEventHandler(myMediaElement_Loaded);
  
              }
              catch (Exception ex)
              {
  
              }
          }
  </code></pre>
  
  <p>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();
                  }</p>
  
  <pre><code>            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;
          }
  
      }
  </code></pre>