视频在WPF中8到10分钟后自动停止

视频在WPF中8到10分钟后自动停止,wpf,wpftoolkit,wpf-4.0,Wpf,Wpftoolkit,Wpf 4.0,我正在wpf中使用媒体元素并以重复行为播放视频,但一段时间后我的视频无法播放,请建议我需要做什么,以便我的视频永远不会停止或挂起。 下面给出了我使用的代码 前端:- <MediaElement Name="myMediaElement" IsMuted="True" Stretch="Fill" Width="768" Height="500" UnloadedBehavior="Stop" LoadedBehavior="Manual">

我正在wpf中使用媒体元素并以重复行为播放视频,但一段时间后我的视频无法播放,请建议我需要做什么,以便我的视频永远不会停止或挂起。 下面给出了我使用的代码

前端:-

  <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" />

                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger.Actions>
                        </EventTrigger>
                    </MediaElement.Triggers>
                </MediaElement>
私人无效播放视频 { 尝试 { string filePath=string.Empty; 字符串_pathVedioRotater=_dynamicFilePath+TopVideoRotate.xml; var doc=新的XmlDocument; doc.Load_pathVedioRotater; XmlNodeList设置=doc.GetElementsByTagNameVideo; 设置中的foreach XmlNode项 { 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;
        }

    }
            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;
        }

    }