Media​Playback​List Media​Playback​List Media​Playback​List Class

Definition

Represents a list of MediaPlaybackItem objects that can be played back. Provides methods for switching the currently playing item and enabling looping and shuffling.

public : sealed class MediaPlaybackList : IMediaPlaybackList, IMediaPlaybackList2, IMediaPlaybackList3, IMediaPlaybackSourcepublic sealed class MediaPlaybackList : IMediaPlaybackList, IMediaPlaybackList2, IMediaPlaybackList3, IMediaPlaybackSourcePublic NotInheritable Class MediaPlaybackList Implements IMediaPlaybackList, IMediaPlaybackList2, IMediaPlaybackList3, IMediaPlaybackSource
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

Items in a MediaPlaybackList are rendered using gapless playback. The system will use provided metadata in MP3 or AAC encoded files to determine the delay or padding compensation needed for gapless playback. If the MP3 or AAC encoded files don't provide this metadata, then the system determines the delay or padding heuristically. For lossless formats, such as PCM, FLAC, or ALAC, the system takes no action because these encoders don't introduce delay or padding.

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

Constructors

MediaPlaybackList() MediaPlaybackList() MediaPlaybackList()

Initializes a new instance of the MediaPlaybackList class.

public : MediaPlaybackList()public MediaPlaybackList()Public Sub New()
Attributes

Properties

AutoRepeatEnabled AutoRepeatEnabled AutoRepeatEnabled

Gets or sets a value indicating whether the playback list will loop when the end of the list is reached.

public : PlatForm::Boolean AutoRepeatEnabled { get; set; }public bool AutoRepeatEnabled { get; set; }Public ReadWrite Property AutoRepeatEnabled As bool
Value
PlatForm::Boolean bool bool

True if auto-repeat is enabled; otherwise, false.

Attributes

CurrentItem CurrentItem CurrentItem

Gets the currently playing MediaPlaybackItem.

public : MediaPlaybackItem CurrentItem { get; }public MediaPlaybackItem CurrentItem { get; }Public ReadOnly Property CurrentItem As MediaPlaybackItem
Attributes

CurrentItemIndex CurrentItemIndex CurrentItemIndex

Gets the index of the current item in the@Windows.Media.Playback.MediaPlaybackList?text=MediaPlaybackList.

public : unsigned short CurrentItemIndex { get; }public uint CurrentItemIndex { get; }Public ReadOnly Property CurrentItemIndex As uint
Value
unsigned short uint uint

The index of the current item in the@Windows.Media.Playback.MediaPlaybackList?text=MediaPlaybackList.

Attributes

Items Items Items

Gets an IObservableVector representation of the playback list.

public : IObservableVector<MediaPlaybackItem> Items { get; }public IObservableVector<MediaPlaybackItem> Items { get; }Public ReadOnly Property Items As IObservableVector<MediaPlaybackItem>
Attributes

MaxPlayedItemsToKeepOpen MaxPlayedItemsToKeepOpen MaxPlayedItemsToKeepOpen

Gets or sets a value that specifies the number of MediaPlaybackItem objects that should be kept open after they have been played.

public : IReference<uint> MaxPlayedItemsToKeepOpen { get; set; }public Nullable<uint> MaxPlayedItemsToKeepOpen { get; set; }Public ReadWrite Property MaxPlayedItemsToKeepOpen As Nullable<uint>
Value
IReference<unsigned short> Nullable<uint> Nullable<uint>

A value that specifies the number of MediaPlaybackItem objects that should be kept open after they have been played.

Attributes
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

Remarks

Set this value to cause the system to keep the specified number of media playback items open after they have been played so that, if the users navigates backwards through the playback list, the open items can be played immediately without needing to be reopened. The trade off is that the more items that are kept open, the more memory is used by your app, which is especially important to consider with background media playback, where resources are more limited than for a foreground app.

MaxPrefetchTime MaxPrefetchTime MaxPrefetchTime

Gets or sets the maximum time before a MediaPlaybackItem in the list is expected to play that the media content associated with the item is retrieved.

public : IReference<TimeSpan> MaxPrefetchTime { get; set; }public Nullable<TimeSpan> MaxPrefetchTime { get; set; }Public ReadWrite Property MaxPrefetchTime As Nullable<TimeSpan>
Value
IReference<TimeSpan> Nullable<TimeSpan> Nullable<TimeSpan>

The maximum time before a MediaPlaybackItem in the list is expected to play that the media content associated with the item is retrieved.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10586.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v2)

ShuffledItems ShuffledItems ShuffledItems

Gets a read-only list of of MediaPlaybackItem objects that will be played in shuffle mode, in the order in which they will be played.

public : IVectorView<MediaPlaybackItem> ShuffledItems { get; }public IReadOnlyList<MediaPlaybackItem> ShuffledItems { get; }Public ReadOnly Property ShuffledItems As IReadOnlyList<MediaPlaybackItem>
Value
IVectorView<MediaPlaybackItem> IReadOnlyList<MediaPlaybackItem> IReadOnlyList<MediaPlaybackItem>

A read-only list of of MediaPlaybackItem objects that will be played in shuffle mode

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10586.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v2)

Remarks

Replace the list of pending shuffled items by calling SetShuffledItems.

ShuffleEnabled ShuffleEnabled ShuffleEnabled

Gets or sets a value indicating whether the items in the playback list are played in a random order.

public : PlatForm::Boolean ShuffleEnabled { get; set; }public bool ShuffleEnabled { get; set; }Public ReadWrite Property ShuffleEnabled As bool
Value
PlatForm::Boolean bool bool

True if shuffle is enabled; otherwise, false.

Attributes

StartingItem StartingItem StartingItem

Gets or sets the MediaPlaybackItem that will be played first.

public : MediaPlaybackItem StartingItem { get; set; }public MediaPlaybackItem StartingItem { get; set; }Public ReadWrite Property StartingItem As MediaPlaybackItem
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10586.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v2)

Remarks

The MediaPlaybackItem specified for this property is played first regardless of whether ShuffleEnabled is true.

Methods

MoveNext() MoveNext() MoveNext()

Changes the current item of the MediaPlaybackList to the next item in the list.

public : MediaPlaybackItem MoveNext()public MediaPlaybackItem MoveNext()Public Function MoveNext() As MediaPlaybackItem
Returns
Attributes

Remarks

This current item of the MediaPlaybackList can't be changed while a MediaPlaybackItem with CanSkip set to false is playing. Attempting to do so will cause an exception to be thrown.

MovePrevious() MovePrevious() MovePrevious()

Changes the current item of the MediaPlaybackList to the previous item in the list.

public : MediaPlaybackItem MovePrevious()public MediaPlaybackItem MovePrevious()Public Function MovePrevious() As MediaPlaybackItem
Returns
Attributes

Remarks

This current item of the MediaPlaybackList can't be changed while a MediaPlaybackItem with CanSkip set to false is playing. Attempting to do so will cause an exception to be thrown.

MoveTo(UInt32) MoveTo(UInt32) MoveTo(UInt32)

Changes the current item of the MediaPlaybackList to the item with the specified index.

public : MediaPlaybackItem MoveTo(unsigned int itemIndex)public MediaPlaybackItem MoveTo(UInt32 itemIndex)Public Function MoveTo(itemIndex As UInt32) As MediaPlaybackItem
Parameters
itemIndex
unsigned int UInt32 UInt32

The index of the item to make current.

Returns
Attributes

Remarks

This current item of the MediaPlaybackList can't be changed while a MediaPlaybackItem with CanSkip set to false is playing. Attempting to do so will cause an exception to be thrown.

SetShuffledItems(IIterable<MediaPlaybackItem>) SetShuffledItems(IIterable<MediaPlaybackItem>) SetShuffledItems(IIterable<MediaPlaybackItem>)

Sets the list of MediaPlaybackItem objects that will be played in shuffle mode, in the order in which they will be played.

public : void SetShuffledItems(IIterable<MediaPlaybackItem> value)public void SetShuffledItems(IEnumerable<MediaPlaybackItem> value)Public Function SetShuffledItems(value As IEnumerable<MediaPlaybackItem>) As void
Parameters
value
IIterable<MediaPlaybackItem> IEnumerable<MediaPlaybackItem> IEnumerable<MediaPlaybackItem>

The list of MediaPlaybackItem objects that will be played in shuffle mode.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10586.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v2)

Remarks

Use this method to manage the order in which items are played when ShuffleEnabled is set to true, replacing the shuffle order generated by the system.

Events

CurrentItemChanged CurrentItemChanged CurrentItemChanged

Occurs when the currently playing MediaPlaybackItem changes.

public : event TypedEventHandler CurrentItemChangedpublic event TypedEventHandler CurrentItemChangedPublic Event CurrentItemChanged
Attributes

ItemFailed ItemFailed ItemFailed

Occurs when an error is encountered with a MediaPlaybackItem in the playback list.

public : event TypedEventHandler ItemFailedpublic event TypedEventHandler ItemFailedPublic Event ItemFailed
Attributes

ItemOpened ItemOpened ItemOpened

Occurs when a MediaPlaybackItem in the playback list is successfully opened.

public : event TypedEventHandler ItemOpenedpublic event TypedEventHandler ItemOpenedPublic Event ItemOpened
Attributes

See Also