0

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?

James Cadd
  • 12,136
  • 30
  • 85
  • 134

2 Answers2

1

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.

James Cadd
  • 12,136
  • 30
  • 85
  • 134
0

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

Community
  • 1
  • 1
Johnonly
  • 49
  • 1
  • 4