How to: Repeat Media Playback

This example shows how to playback media indefinitely, that is, to set media so that it plays in an infinite loop.


The following example uses MediaElement and MediaTimeline in a Storyboard to play a media clip in an infinite loop.

<Page xmlns=""
  xmlns:x="" >

    <!-- The MediaElement control plays the sound. -->
    <MediaElement Name="myMediaElement" >
        <EventTrigger RoutedEvent="MediaElement.Loaded">

                <!-- The MediaTimeline has a RepeatBehavior="Forever" which makes the media play
                     over and over indefinitely.-->
                <MediaTimeline Source="media\tada.wav" Storyboard.TargetName="myMediaElement"  
                 RepeatBehavior="Forever" />



See Also

How-to Topics
Graphics and Multimedia