O'Reilly logo

Windows Application Development Cookbook by Marcin Jamro

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 a movie clip

Developing an application that presents a movie is really easy due to the availability of a dedicated control with a set of useful methods, as you will see in this recipe.

Getting ready

To step through this recipe, you need only the automatically generated project.

How to do it...

Place the Movie.mp4 file in the Assets directory and add the MediaElement control to the page by modifying the content of the MainPage.xaml file as follows:

    <Page (...)> 
        <Grid> 
            <MediaElement 
                Source="/Assets/Movie.mp4" 
                Stretch="UniformToFill" 
                AutoPlay="True" 
                AreTransportControlsEnabled="True" 
                VerticalAlignment="Center" 
                HorizontalAlignment="Center" />     
        </Grid> 
    </Page> 

How it works...

MediaElement is a very useful control that allows media content to be ...

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