#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


About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: