How to enable full window video rendering
[ This article is for Windows 8.x and Windows Phone 8.x developers writing Windows Runtime apps. If you’re developing for Windows 10, see the latest documentation ]
Use MediaElement.IsFullWindow to enable and disable full window video rendering in a Windows Runtime app using C++, C#, or Visual Basic.
Roadmap: How does this topic relate to others? See:
- Roadmap for Windows Runtime apps using C# or Visual Basic
- Roadmap for Windows Runtime apps using C++
- To see this feature in action as part of a complete media-playback sample, see Media playback, start to finish.
What you need to know
Technologies
- Windows Runtime
Prerequisites
This topic assumes that you can create a basic Windows Runtime app using C++, C#, or Visual Basic. For help creating your first app, see Create your first Windows Store app using C# or Visual Basic.
This topic assumes you are familiar with the MediaElement class. For an introduction on using the MediaElement class, see the Quickstart: video and audio.
Instructions
Step 1: Built in transport controls
Windows 8.1 introduces new built in transport controls for the MediaElement class. These controls have a full window button which toggles full window rendering on and off. To enable the built in transport controls, set AreTransportControlsEnabled to true.
Here is some code that creates a MediaElement with the built in transport controls enabled and the AutoPlay property set to false.
<MediaElement x:Name="mediaPlayer"
Source="Videos/video1.mp4"
Width="400"
AutoPlay="False"
AreTransportControlsEnabled="True" />
Step 2: Programmatically set full window
Windows 8.1 introduces a new full window property on the MediaElement called IsFullWindow. Setting IsFullWindow enables and disables full window rendering.
When programmatically setting full window rendering in your app, you should always use the IsFullWindow instead of doing it manually. IsFullWindow insures that system level optimizations are performed which improve performance and battery life. If full window is not set up correctly, these optimizations may not be enabled.
Here is some code that creates an AppBarButton that toggles full window rendering.
<Page.BottomAppBar>
<AppBar>
<AppBarButton Icon="FullScreen"
Label="Full Window"
Click="FullWindow_Click" />
</AppBar>
</Page.BottomAppBar>
private void FullWindow_Click(object sender, object e)
{
mediaPlayer.IsFullWindow = !media.IsFullWindow;
}
Related topics
Roadmaps
Roadmap for Windows Runtime apps using C# and Visual Basic
Roadmap for Windows Runtime apps using C++
Samples
Media playback, start to finish
Tasks
Quickstart: create a media player application
Reference
Other resources