为什么 WPF MediaElement 中的视频需要很长时间才能重复?

发布于 2024-08-03 05:38:18 字数 962 浏览 4 评论 0原文

这是我的 MediaElement 的 Xaml:

        <MediaElement x:Name="mediaElement" Width="400" Height="300" Stretch="UniformToFill" IsMuted="True">
            <MediaElement.Triggers>
                <EventTrigger RoutedEvent="MediaElement.Loaded">
                    <EventTrigger.Actions>
                        <BeginStoryboard>
                            <Storyboard>
                                <MediaTimeline Source="temp.wmv" Storyboard.TargetName="mediaElement" RepeatBehavior="Forever" />
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger.Actions>
                </EventTrigger>
            </MediaElement.Triggers>
        </MediaElement>

视频 temp.wmv 大约 10 兆,长 2 分钟...它的清晰度也不是很高,我认为它低于 DVD 质量。我希望故事板能够在视频结束后立即从头开始播放,但由于某种原因,视频需要很长时间(有时是几分钟)才能重新开始。有什么因素可能会影响视频重复播放的时间吗?

Here's my Xaml for a MediaElement:

        <MediaElement x:Name="mediaElement" Width="400" Height="300" Stretch="UniformToFill" IsMuted="True">
            <MediaElement.Triggers>
                <EventTrigger RoutedEvent="MediaElement.Loaded">
                    <EventTrigger.Actions>
                        <BeginStoryboard>
                            <Storyboard>
                                <MediaTimeline Source="temp.wmv" Storyboard.TargetName="mediaElement" RepeatBehavior="Forever" />
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger.Actions>
                </EventTrigger>
            </MediaElement.Triggers>
        </MediaElement>

the video temp.wmv is about 10 megs and 2 minutes long... it's not terribly high def either, I think it's below DVD quality. I expected the Storyboard to make the video start from the beginning immediately after it finishes, but for some reason it takes a long time, sometimes minutes, for the video to start back up. Is there anything that could be effecting the time it takes for the video to repeat?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

无所的.畏惧 2024-08-10 05:38:18

对于任何其他关注此问题的人来说,WPF 3.5 sp1 中的 MediaElement 存在严重错误,并且将在 4.0 中收到许多 beta 1 中没有的修复。请在此处尝试 Jeremiah Morrill 的开源 WPF MediaKit http://wpfmediakit.codeplex.com 并使用 MediaUriElement 和 Loop=true 以获得良好的循环媒体体验。

For any others looking at this - the MediaElement in WPF 3.5 sp1 is horribly buggy and will receive many fixes in 4.0 that aren't in beta 1. Try Jeremiah Morrill's open source WPF MediaKit here http://wpfmediakit.codeplex.com and use the MediaUriElement with Loop=true for a good looping media experience.

心头的小情儿 2024-08-10 05:38:18

我刚刚遇到这个问题,使用媒体元素查找 5mb wmv 需要 2 秒。但 500mb 的 avi 几乎可以立即同步。我发布了我的代码和表格,它可能对您有用...如果您愿意,我也可以将项目发送给您...如果它是 avi 或 mpg,则几乎完美,但 wmv 将永远需要...绝对不可接受..

在特定时间启动和停止 MediaElement

I just ran into this problem, a 5mb wmv took 2 seconds to seek using media element. But a 500mb avi could sync in nearly instantly. I posted my code and form it might be of use to you ... if you like I can send the project to you as well ... if seeks nearly perfectly if it is avi or mpg but wmv would take forever.. definitely unacceptable..

Start and stop MediaElement at specific times

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文