Media playback

This section provides information on creating Universal Windows apps that playback audio and video.

Media playback developer features

The following table lists the how-to articles that provide detailed guidance for adding media playback features to your app.

Topic Description
Play audio and video with MediaPlayer This article shows you how to take advantage of the new features and improvements to the media playback system for UWP apps. Starting with Windows 10, version 1607,the recommended best practice for playing media is to use the MediaPlayer class instead of MediaElement for media playback. The lightweight XAML control, MediaPlayerElement, has been introduced to allow you render media content in a XAML page. MediaPlayer provides several advantages including automatic integration with the System Media Transport Controls and a simpler, one-process model for background audio. This article also shows you how to render video to a Windows.UI.Composition surface and how to use a MediaTimelineController to synchronize multiple media players.
Media items, playlists, and tracks This article shows you how to use the MediaSource class, which provides a common way to reference and play back media from different sources such as local or remote files and exposes a common model for accessing media data, regardless of the underlying media format. The MediaPlaybackItem class extends the functionality of MediaSource, allowing you to manage and select from multiple audio, video, and metadata tracks contained in a media item. MediaPlaybackList allows you to create playback lists from one or more media playback items.
Integrate with the System Media Transport Controls This article shows you how to integrate your app with the System Media Transport Controls (SMTC). Starting with Windows 10, version 1607, every instance of MediaPlayer that you create to play media is automatically displayed by the SMTC. This article shows you how to provide the SMTC with metadata about the content you are playing and how to augment or completely override the default behavior of SMTC controls.
System-supported timed metadata cues This article describes how to take advantage of several formats of timed metadata that may be embedded in media files or streams.
Create, schedule, and manage media breaks This article shows you how to create, schedule, and manage media breaks to your media playback app. Starting with Windows 10, version 1607, you can use the MediaBreakManager class to quickly and easy add media breaks to any MediaPlaybackItem that you play with a MediaPlayer. Media breaks are typically used to insert audio or video ads into media content. Once you schedule one or more media breaks, the system will automatically play your media content at the specified time during playback. The MediaBreakManager provides events so that your app can react when media breaks start, end, or when they are skipped by the user. You can also access a MediaPlaybackSession for your media breaks to monitor events like download and buffering progress updates.
Play media in the background This article shows you how to configure your app so that media continues to play when your app moves from the foreground to the background. This means that even after the user has minimized your app, returned to the home screen, or has navigated away from your app in some other way, your app can continue to play audio. With Windows 10, version 1607, a new single-process model for background media playback has been introduced that is much quicker and easier to implement than the legacy two-process model. This article includes information on handling the new application lifecycle events EnteredBackground and LeavingBackground to manage your app's memory usage while running in the background.
Adaptive Streaming This article describes how to add playback of adaptive streaming multimedia content to a Universal Windows Platform (UWP) apps. This feature currently supports playback of Http Live Streaming (HLS) and Dynamic Streaming over HTTP (DASH) content.
Media casting This article shows you how to cast media to remote devices from a Universal Windows app.
Enable audio playback from remote Bluetooth-connected devices This article shows you how to use AudioPlaybackConnection to enable Bluetooth-connected remote devices to play back audio on the local machine, enabling scenarios such as configuring a PC to behave like a Bluetooth speaker and allowing users to hear audio from their phone.
PlayReady DRM This topic describes how to add PlayReady protected media content to your Universal Windows Platform (UWP) app.
PlayReady Encrypted Media Extension This section describes how to modify your PlayReady Web app to support the changes made from the previous Windows 8.1 version to the Windows 10 version.

Media playback SDK samples

The following SDK samples demonstrate the media playback features available to UWP apps on Windows 10. Use these samples to see the media playback APIs used in context or as a starting point for your own app.