Share via


MediaPlaybackItem Class

Definition

Represents a media item that can be played back. This class acts as a wrapper around a MediaSource that exposes the audio tracks, video tracks, and timed metadata tracks included in the media source.

public ref class MediaPlaybackItem sealed
/// [Windows.Foundation.Metadata.Activatable(Windows.Media.Playback.IMediaPlaybackItemFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class MediaPlaybackItem final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(Windows.Media.Playback.IMediaPlaybackItemFactory, 65536, "Windows.Foundation.UniversalApiContract")]
class MediaPlaybackItem final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(Windows.Media.Playback.IMediaPlaybackItemFactory, 65536, "Windows.Foundation.UniversalApiContract")]
/// [Windows.Foundation.Metadata.Activatable(Windows.Media.Playback.IMediaPlaybackItemFactory2, 196608, "Windows.Foundation.UniversalApiContract")]
class MediaPlaybackItem final
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Media.Playback.IMediaPlaybackItemFactory), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class MediaPlaybackItem
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Media.Playback.IMediaPlaybackItemFactory), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class MediaPlaybackItem
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Media.Playback.IMediaPlaybackItemFactory), 65536, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Media.Playback.IMediaPlaybackItemFactory2), 196608, "Windows.Foundation.UniversalApiContract")]
public sealed class MediaPlaybackItem
function MediaPlaybackItem(source)
function MediaPlaybackItem(source, startTime, durationLimit)
Public NotInheritable Class MediaPlaybackItem
Inheritance
Object Platform::Object IInspectable MediaPlaybackItem
Attributes
Implements

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Remarks

A MediaPlaybackItem can be passed directly to a player such as MediaPlayer, MediaElement or MediaPlayerElement. Or, you can even pass the player a list of multiple media playback items using the MediaPlaybackList class.

For how-to guidance for working with media items, see Media items, playlists, and tracks.

Version history

Windows version SDK version Value added
1511 10586 FindFromMediaSource
1607 14393 MediaPlaybackItem(MediaSource,TimeSpan)
1607 14393 MediaPlaybackItem(MediaSource,TimeSpan,TimeSpan)
1607 14393 ApplyDisplayProperties
1607 14393 BreakSchedule
1607 14393 CanSkip
1607 14393 DurationLimit
1607 14393 GetDisplayProperties
1607 14393 StartTime
1703 15063 AutoLoadedDisplayProperties
1703 15063 IsDisabledInPlaybackList
1703 15063 TotalDownloadProgress

Constructors

MediaPlaybackItem(MediaSource, TimeSpan, TimeSpan)

Initializes a new instance of the MediaPlaybackItem class with a StartTime value indicating the position within the item where playback should begin and a DurationLimit value specifying the maximum playback duration of the item.

MediaPlaybackItem(MediaSource, TimeSpan)

Initializes a new instance of the MediaPlaybackItem class with a StartTime value indicating the position within the item where playback should begin.

MediaPlaybackItem(MediaSource)

Initializes a new instance of the MediaPlaybackItem class.

Properties

AudioTracks

Gets a read-only list of audio tracks in the MediaSource associated with the MediaPlaybackItem.

AutoLoadedDisplayProperties

Gets or sets a value that specifies for which types of media content, if any, the system should automatically load metadata to display in the System Media Transport Controls.

BreakSchedule

Gets the MediaBreakSchedule defining the schedule of media breaks for the MediaPlaybackItem.

CanSkip

Gets or sets a value indicating whether the MediaPlaybackItem can be skipped.

DurationLimit

Gets the maximum playback duration of the MediaPlaybackItem.

IsDisabledInPlaybackList

Gets or sets a value that specifies whether a MediaPlaybackItem is disabled in a MediaPlaybackList.

Source

Gets the MediaSource object associated with the MediaPlaybackItem.

StartTime

Gets the position within the MediaPlaybackItem where playback should begin.

TimedMetadataTracks

Gets a read-only list of timed metadata tracks in the MediaSource associated with the MediaPlaybackItem.

TotalDownloadProgress

Gets a value that indicates the proportion of the data for the MediaPlaybackItem that is currently downloaded.

VideoTracks

Gets a read-only list of video tracks in the MediaSource associated with the MediaPlaybackItem.

Methods

ApplyDisplayProperties(MediaItemDisplayProperties)

Updates the display properties for the MediaPlaybackItem. These properties are used by the System Media Transport Controls to display information about the currently playing media item.

FindFromMediaSource(MediaSource)

Retrieves the MediaPlaybackItem associated with the provided MediaSource.

GetDisplayProperties()

Gets the display properties for a MediaPlaybackItem.

Events

AudioTracksChanged

Occurs when the list of audio tracks in the MediaSource associated with the MediaPlaybackItem changes.

TimedMetadataTracksChanged

Occurs when the list of timed metadata tracks in the MediaSource associated with the MediaPlaybackItem changes.

VideoTracksChanged

Occurs when the list of video tracks in the MediaSource associated with the MediaPlaybackItem changes.

Applies to

See also