#8 – Audio and Video

WPF makes it very easy to play audio or video content in your application.  You can play any media type supported by Windows Media Player including audio formats like WAV and MP3 or video formats like AVI, WMV, and MPG.

You play audio and video by including a media UI element directly in your XAML.  This allows rendering and playing video on a wide variety of user controls.  Here’s an example of a video playing on the surface of a Button.

<Button Height="258" HorizontalAlignment="Left" Margin="26,21,0,0" Name="button1" VerticalAlignment="Top" Width="436" >
       <MediaElement Source="C:\Users\Public\Videos\Sample Videos\Wildlife.wmv" Stretch="Fill"/>

More Info: MSDN or CodePlex