Thumbnails for video in WPF


I received a question:

How do you show thumbnails of the video ahead of time?

Interestingly silverlight if you set the AutoPlay property to “False” it automatically does this for you. 

But in a XBAP or a Windows WPF application you need need to have a trigger to set the movie duration to 1 second to get this functionality  – i have included the XAML to do this below.

 

</Grid>

WrapPanel >

<WrapPanel.Triggers>

<EventTrigger RoutedEvent=”MediaElement.Loaded” SourceName=”me1″>

<EventTrigger.Actions>

<BeginStoryboard Name= “myBegin”>

<Storyboard SlipBehavior=”Slip”>

<MediaTimeline Source=”c:\movie.wmv” Storyboard.TargetName=”me1″

 BeginTime=”0:0:0″ Duration=”0:0:1″/>

</Storyboard>

</BeginStoryboard>

</EventTrigger.Actions>

</EventTrigger>

</WrapPanel.Triggers>

<Button Height=”200″ Width=”200″>

<MediaElement Name=”me1″ Source=”c:\movie.wmv” LoadedBehavior=”Manual”>

</MediaElement>

</Button>

</WrapPanel>

</Grid>


Comments (1)

  1. Turns out this behaviour is only guaranteed in Silverlight with progressive download media.

    If the content is streamed ie mms:// it will depend if the streaming server allows seeking.