MediaPlayer Class

Provides media playback for drawings.

Namespace: System.Windows.Media
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace:

public class MediaPlayer : Animatable
public class MediaPlayer extends Animatable
public class MediaPlayer extends Animatable
 You cannot use this managed class in XAML. 

Although you can declare an instance of this class in Extensible Application Markup Language (XAML), you cannot load and play its media without using code. To play media in XAML only, use a MediaElement.

When distributing media with your application, you cannot use a media file as a project resource. In your project file, you must instead set the media type to Content and set CopyToOutputDirectory to PreserveNewest or Always.

MediaPlayer can be used in two different modes, depending on what is driving the player: independent mode or clock mode. In independent mode, the MediaPlayer is analogous to an image and the media opened through the Open method drives playback. In Clock mode, the MediaPlayer can be thought of as a target for an animation, and thus it will have corresponding Timeline and Clock entries in the Timing tree which controls playback. For more information on media modes, see the Multimedia Overview.

MediaPlayer is different from a MediaElement in that it is not a control that can be added directly to the user interface (UI) of an application. To display media loaded using MediaPlayer, a VideoDrawing or DrawingContext must be used.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions