MediaPlayer.GetSurface(Compositor) Method


Gets a MediaPlayerSurface object for the MediaPlayer, which allows you to render the player's contents using a Compositor without relying on the XAML framework.

 virtual MediaPlayerSurface ^ GetSurface(Compositor ^ compositor) = GetSurface;
MediaPlayerSurface GetSurface(Compositor const & compositor);
public MediaPlayerSurface GetSurface(Compositor compositor);
function getSurface(compositor)
Public Function GetSurface (compositor As Compositor) As MediaPlayerSurface



The Compositor with which the returned surface will be used.



The media player surface.

Windows 10 requirements

Device family
Windows 10 Anniversary Edition (introduced in 10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v3.0)


By default, the CompositionSurface generated by this method will have the dimensions 640x 480, in pixels. To get a different size, call SetSurfaceSize before calling GetSurface.

You can obtain multiple surfaces from a single MediaPlayer instance by calling GetSurface multiple times.

For more information on using the Windows.UI.Composition APIs to render visuals, see Visual layer.

For how-to guidance for rendering video to a composition surface, see Play audio and video with MediaPlayer.

Applies to

See also