O'Reilly logo

Windows® Phone 8 Unleashed by Daniel Vaughan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Playing Audio and Video with the MediaElement

MediaElement allows you to play audio and video from a file located in the app’s XAP file, from isolated storage, or by streaming it from a remote location. MediaElement is a FrameworkElement that provides a rectangular region used for displaying video on its surface.

To show video content in your app, place the MediaElement markup where you want the video to be displayed, as shown in the following example:

<MediaElement Source="http://www.example.net/Video.wmv" />

After the MediaElement is loaded, it begins to download and play the content.

Note

The XNA SoundEffect class is better suited to playing short sound effects. There can be a slight delay when first playing a sound using the MediaElement ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required